SIGSUSPEND(2) SIGSUSPEND(2) NAME sigsuspend - atomically release blocked signals and wait for interrupt (POSIX) SYNOPSIS int sigsuspend(const sigset_t *maskptr); DESCRIPTION sigsuspend replaces the current thread's set of masked signals with the set pointed to by maskptr and then suspends the thread until delivery of a signal whose action is either to execute a signal-catching function or to terminate the process. If the action is to terminate the process then sigsuspend will never return. If the action is to execute a signal-catching function, then sigsuspend will return after the signal-catching functions returns, with the signal mask restored to the set that existed prior to the sigsuspend call. In normal usage, a signal is blocked via sigprocmask(2) to begin a critical section, variables modified on the occurrence of the signal are examined to determine that there is no work to be done, and the thread pauses by calling sigsuspend with the mask returned by sigprocmask. It is not possible to block signals that cannot be ignored. This is enforced by the system without causing an error to be indicated. Routines described in sigsetops(3) are used to create and manipulate the input-parameter signal masks submitted to sigaction(2), sigprocmask(2), and sigsuspend(2), and returned by sigpending(2). These masks are of type sigset_t. NOTES POSIX specifies (contrary to BSD and System V) that a thread may block SIGCONT. However, a) SIGCONT always restarts the receiving process (unless it is waiting for an event such as I/O), and b) if the receiving process has installed a handler for SIGCONT and blocked the signal, the process will NOT enter its handler until it unblocks SIGCONT. (The signal will remain pending.) Therefore, if sigsuspend is called with a mask which blocks SIGCONT, receipt of that signal will set the process running, but not cause it to enter a handler. RETURN VALUE Since sigsuspend suspends process execution indefinitely, there is no successful completion return value. If a return occurs, -1 is returned and errno is set to indicate the error. ERRORS The sigsuspend function will fail if: [EINTR] A signal is caught by the calling thread and control is returned from the signal-catching function. [EFAULT] maskptr points to memory that is not a part of process's valid address space. SEE ALSO sigaction(2), sigpending(2), sigprocmask(2), sigsetops(3). WARNING The POSIX and System V signal facilities have different semantics. Using both facilities in the same program is strongly discouraged and will result in unpredictable behavior. Page 2