Handle_Ops.cpp

Go to the documentation of this file.
00001 // $Id: Handle_Ops.cpp 80826 2008-03-04 14:51:23Z wotte $
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            "$Id: Handle_Ops.cpp 80826 2008-03-04 14:51:23Z wotte $")
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 const handle = ACE_OS::open (name, flags, perms, sa);
00035 
00036       if (handle == ACE_INVALID_HANDLE
00037           && (errno == EWOULDBLOCK
00038               && (timeout->sec () > 0 || timeout->usec () > 0)))
00039         // This expression checks if we were polling.
00040         errno = ETIMEDOUT;
00041 
00042       return handle;
00043     }
00044   else
00045     return ACE_OS::open (name, flags, perms, sa);
00046 }
00047 
00048 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:18:39 2010 for ACE by  doxygen 1.4.7