Handle_Ops.cpp

Go to the documentation of this file.
00001 // Handle_Ops.cpp,v 1.9 2005/10/28 16:14:52 ossama Exp
00002 
00003 #include "ace/Handle_Ops.h"
00004 
00005 #include "ace/OS_NS_errno.h"
00006 #include "ace/OS_NS_fcntl.h"
00007 #include "ace/Time_Value.h"
00008 
00009 ACE_RCSID (ace,
00010            Handle_Ops,
00011            "Handle_Ops.cpp,v 1.9 2005/10/28 16:14:52 ossama Exp")
00012 
00013 
00014 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00015 
00016 ACE_HANDLE
00017 ACE::handle_timed_open (ACE_Time_Value *timeout,
00018                         const ACE_TCHAR *name,
00019                         int flags,
00020                         int perms,
00021                         LPSECURITY_ATTRIBUTES sa)
00022 {
00023   ACE_TRACE ("ACE::handle_timed_open");
00024 
00025   if (timeout != 0)
00026     {
00027 #if !defined (ACE_WIN32)
00028       // On Win32, ACE_NONBLOCK gets recognized as O_WRONLY so we
00029       // don't use it there
00030       flags |= ACE_NONBLOCK;
00031 #endif /* ACE_WIN32 */
00032 
00033       // Open the named pipe or file using non-blocking mode...
00034       ACE_HANDLE handle = ACE_OS::open (name,
00035                                         flags,
00036                                         perms,
00037                                         sa);
00038       if (handle == ACE_INVALID_HANDLE
00039           && (errno == EWOULDBLOCK
00040               && (timeout->sec () > 0 || timeout->usec () > 0)))
00041         // This expression checks if we were polling.
00042         errno = ETIMEDOUT;
00043 
00044       return handle;
00045     }
00046   else
00047     return ACE_OS::open (name, flags, perms, sa);
00048 }
00049 
00050 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 09:41:51 2006 for ACE by doxygen 1.3.6