?? pselect.c
字號:
/*
* This is *not* a complete implementation of the Posix.1g pselect()
* function. For atomicity this must be implemented within the kernel,
* with the sigprocmask/select/sigprocmask performed as a single atomic
* operation.
* This is just a quick hack to allow simple programs using it to compile.
* Using such programs with this hack will probably lead to race conditions.
*/
/* include pselect */
#include "unpipc.h"
int
pselect(int nfds, fd_set *rset, fd_set *wset, fd_set *xset,
const struct timespec *ts, const sigset_t *sigmask)
{
int n;
struct timeval tv;
sigset_t savemask;
if (ts != NULL) {
tv.tv_sec = ts->tv_sec;
tv.tv_usec = ts->tv_nsec / 1000; /* nanosec -> microsec */
}
sigprocmask(SIG_SETMASK, sigmask, &savemask); /* caller's mask */
n = select(nfds, rset, wset, xset, (ts == NULL) ? NULL : &tv);
sigprocmask(SIG_SETMASK, &savemask, NULL); /* restore mask */
return(n);
}
/* end pselect */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -