#include <SysUtil.h>
Definition at line 63 of file SysUtil.h.
Static Public Member Functions | |
| static int | select (int max=0, fd_set *rfs=0, fd_set *wfs=0, fd_set *efs=0, struct timeval *timeout=0, bool restartOnEINTR=true) |
| Call system select with various sets. | |
| static int | select (int max, fd_set *rfs, fd_set *wfs, fd_set *efs, uint64_t timeout, bool restartOnEINTR=true) |
| constructs a timeval, and calls select(int, fd_set*, fd_set*, fd_set*, struct timeval*, bool) | |
| static sighandler_t | signal (int signum, sighandler_t handler, bool warn=true) |
Install signal handler handler for signum, warn on duplicate if warn. | |
| static void | sleep (time_t sec=0, useconds_t usec=0) |
| Sleep an optional number of seconds and (< 1000000) microsecods (0 means infinite). | |
| static void | sleepu (uint64_t usec) |
| Sleep a number of microseconds (0 means infinite). | |
| static void | sleepm (useconds_t msec) |
| Sleep a number of milliseconds (0 means infinite). | |
| int SysUtil::select | ( | int | max = 0, |
|
| fd_set * | rfs = 0, |
|||
| fd_set * | wfs = 0, |
|||
| fd_set * | efs = 0, |
|||
| struct timeval * | timeout = 0, |
|||
| bool | restartOnEINTR = true | |||
| ) | [static] |
Call system select with various sets.
Note about Windows implementation: in the Winsock API, it is invalid to use select to sleep only (without passing in any file descriptors). On Windows, if max is 0, the implementation calls OS sleep instead.
| max | the largest file descriptor (plus one) | |
| rfs | the read fd_set (set of fds to wait for readability) | |
| wfs | the write fd_set (set of fds to wait for writability) | |
| efs | the error fd_set (set of fds to wait for error signals) | |
| timeout | the timeout for select (0 means forever) | |
| restartOnEINTR | whether to restart the sleep if the sleep is interrupted |
Definition at line 53 of file SysUtil.cc.
References ABORT, Log::err(), SockUtil::errorBadF(), SockUtil::errorInterrupted(), TimeUtil::fillTimeval(), SockUtil::getErrno(), Log::perror(), TimeUtil::timeu(), and Log::warn().
Referenced by select(), sleep(), and PipedSignal::wait().
1.5.5