Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   pselect.3p    ( 3 )

синхронное мультиплексирование ввода / вывода (synchronous I/O multiplexing)

Обоснование (Rationale)

In earlier versions of the Single UNIX Specification, the select() function was defined in the <sys/time.h> header. This is now changed to <sys/select.h>. The rationale for this change was as follows: the introduction of the pselect() function included the <sys/select.h> header and the <sys/select.h> header defines all the related definitions for the pselect() and select() functions. Backwards-compatibility to existing XSI implementations is handled by allowing <sys/time.h> to include <sys/select.h>.

Code which wants to avoid the ambiguity of the signal mask for thread cancellation handlers can install an additional cancellation handler which resets the signal mask to the expected value.

void cleanup(void *arg) { sigset_t *ss = (sigset_t *) arg; pthread_sigmask(SIG_SETMASK, ss, NULL); }

int call_pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set errorfds, const struct timespec *timeout, const sigset_t *sigmask) { sigset_t oldmask; int result; pthread_sigmask(SIG_SETMASK, NULL, &oldmask); pthread_cleanup_push(cleanup, &oldmask); result = pselect(nfds, readfds, writefds, errorfds, timeout, sigmask); pthread_cleanup_pop(0); return result; }