Removed ACE_HAS_BSTRING, not used
[ACE_TAO.git] / ACE / ace / Handle_Ops.cpp
blob6d83f91b86c69fbc2ed20525b77ed663000c06ee
1 #include "ace/Handle_Ops.h"
3 #include "ace/OS_NS_errno.h"
4 #include "ace/OS_NS_fcntl.h"
5 #include "ace/Time_Value.h"
8 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
10 ACE_HANDLE
11 ACE::handle_timed_open (ACE_Time_Value *timeout,
12 const ACE_TCHAR *name,
13 int flags,
14 int perms,
15 LPSECURITY_ATTRIBUTES sa)
17 ACE_TRACE ("ACE::handle_timed_open");
19 if (timeout != 0)
21 #if !defined (ACE_WIN32)
22 // On Win32, ACE_NONBLOCK gets recognized as O_WRONLY so we
23 // don't use it there
24 flags |= ACE_NONBLOCK;
25 #endif /* ACE_WIN32 */
27 // Open the named pipe or file using non-blocking mode...
28 ACE_HANDLE const handle = ACE_OS::open (name, flags, perms, sa);
30 if (handle == ACE_INVALID_HANDLE
31 && (errno == EWOULDBLOCK
32 && (timeout->sec () > 0 || timeout->usec () > 0)))
33 // This expression checks if we were polling.
34 errno = ETIMEDOUT;
36 return handle;
38 else
39 return ACE_OS::open (name, flags, perms, sa);
42 ACE_END_VERSIONED_NAMESPACE_DECL