1 // $Id: Handle_Ops.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #include "ace/Handle_Ops.h"
5 #include "ace/OS_NS_errno.h"
6 #include "ace/OS_NS_fcntl.h"
7 #include "ace/Time_Value.h"
11 "$Id: Handle_Ops.cpp 80826 2008-03-04 14:51:23Z wotte $")
14 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
17 ACE::handle_timed_open (ACE_Time_Value
*timeout
,
18 const ACE_TCHAR
*name
,
21 LPSECURITY_ATTRIBUTES sa
)
23 ACE_TRACE ("ACE::handle_timed_open");
27 #if !defined (ACE_WIN32)
28 // On Win32, ACE_NONBLOCK gets recognized as O_WRONLY so we
30 flags
|= ACE_NONBLOCK
;
31 #endif /* ACE_WIN32 */
33 // Open the named pipe or file using non-blocking mode...
34 ACE_HANDLE
const handle
= ACE_OS::open (name
, flags
, perms
, sa
);
36 if (handle
== ACE_INVALID_HANDLE
37 && (errno
== EWOULDBLOCK
38 && (timeout
->sec () > 0 || timeout
->usec () > 0)))
39 // This expression checks if we were polling.
45 return ACE_OS::open (name
, flags
, perms
, sa
);
48 ACE_END_VERSIONED_NAMESPACE_DECL