⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pselect.c

📁 让你了解Unix进程间的通信是如何实现的
💻 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"intpselect(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 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -