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
11 ACE::handle_timed_open (ACE_Time_Value
*timeout
,
12 const ACE_TCHAR
*name
,
15 LPSECURITY_ATTRIBUTES sa
)
17 ACE_TRACE ("ACE::handle_timed_open");
21 #if !defined (ACE_WIN32)
22 // On Win32, ACE_NONBLOCK gets recognized as O_WRONLY so we
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.
39 return ACE_OS::open (name
, flags
, perms
, sa
);
42 ACE_END_VERSIONED_NAMESPACE_DECL