OS_NS_sys_select.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // OS_NS_sys_select.inl,v 1.7 2006/03/13 19:34:05 jwillemsen Exp
00004 
00005 #include "ace/OS_NS_errno.h"
00006 #include "ace/OS_NS_macros.h"
00007 #include "ace/Time_Value.h"
00008 
00009 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00010 
00011 // It would be really cool to add another version of select that would
00012 // function like the one we're defending against below!
00013 ACE_INLINE int
00014 ACE_OS::select (int width,
00015                 fd_set *rfds, fd_set *wfds, fd_set *efds,
00016                 const ACE_Time_Value *timeout)
00017 {
00018   ACE_OS_TRACE ("ACE_OS::select");
00019 #if defined (ACE_HAS_NONCONST_SELECT_TIMEVAL)
00020   // We must defend against non-conformity!
00021   timeval copy;
00022   timeval *timep = 0;
00023 
00024   if (timeout != 0)
00025     {
00026       copy = *timeout;
00027       timep = ©
00028     }
00029   else
00030     timep = 0;
00031 #else
00032   const timeval *timep = (timeout == 0 ? (const timeval *)0 : *timeout);
00033 #endif /* ACE_HAS_NONCONST_SELECT_TIMEVAL */
00034 #if defined(ACE_TANDEM_T1248_PTHREADS)
00035   ACE_SOCKCALL_RETURN (::spt_select (width,
00036                                  (ACE_FD_SET_TYPE *) rfds,
00037                                  (ACE_FD_SET_TYPE *) wfds,
00038                                  (ACE_FD_SET_TYPE *) efds,
00039                                  timep),
00040                        int, -1);
00041 #else
00042   ACE_SOCKCALL_RETURN (::select (width,
00043                                  (ACE_FD_SET_TYPE *) rfds,
00044                                  (ACE_FD_SET_TYPE *) wfds,
00045                                  (ACE_FD_SET_TYPE *) efds,
00046                                  timep),
00047                        int, -1);
00048 #endif
00049 }
00050 
00051 ACE_INLINE int
00052 ACE_OS::select (int width,
00053                 fd_set *rfds, fd_set *wfds, fd_set *efds,
00054                 const ACE_Time_Value &timeout)
00055 {
00056   ACE_OS_TRACE ("ACE_OS::select");
00057 #if defined (ACE_HAS_NONCONST_SELECT_TIMEVAL)
00058 # define ___ACE_TIMEOUT &copy
00059   timeval copy = timeout;
00060 #else
00061 # define ___ACE_TIMEOUT timep
00062   const timeval *timep = timeout;
00063 #endif /* ACE_HAS_NONCONST_SELECT_TIMEVAL */
00064 #if defined(ACE_TANDEM_T1248_PTHREADS)
00065   ACE_SOCKCALL_RETURN (::spt_select (width,
00066                                  (ACE_FD_SET_TYPE *) rfds,
00067                                  (ACE_FD_SET_TYPE *) wfds,
00068                                  (ACE_FD_SET_TYPE *) efds,
00069                                  ___ACE_TIMEOUT),
00070                        int, -1);
00071 #else
00072   ACE_SOCKCALL_RETURN (::select (width,
00073                                  (ACE_FD_SET_TYPE *) rfds,
00074                                  (ACE_FD_SET_TYPE *) wfds,
00075                                  (ACE_FD_SET_TYPE *) efds,
00076                                  ___ACE_TIMEOUT),
00077                        int, -1);
00078 #endif
00079 #undef ___ACE_TIMEOUT
00080 }
00081 
00082 ACE_END_VERSIONED_NAMESPACE_DECL

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