SIGPAUSE(2V)

NAME
sigpause, sigsuspend - automatically release blocked signals and wait for interrupt

SYNOPSIS
int sigpause(sigmask)
int sigmask;

#include <signal.h>

int sigsuspend(sigmaskp)
sigset_t *sigmaskp;

DESCRIPTION

sigpause() assigns sigmask to the set of masked signals and then waits for a signal to arrive; on return the set of masked signals is restored. sigmask is usually 0 to indicate that no signals are now to be blocked. sigpause() always terminates by being interrupted, returning EINTR.

In normal usage, a signal is blocked using sigblock(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 process pauses awaiting work by using sigpause() with the mask returned by sigblock().

sigsuspend() replaces the process's signal mask with the set of signals pointed to by sigmaskp and then suspends the process 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, sigsuspend() does not return. If the action is to execute a signal-catching function, sigsuspend() returns after the signal-catching function returns, with the signal mask restored to the setting that existed prior to the sigsuspend() call. It is not possible to block those signals that cannot be ignored, as documented in <signal.h> this is enforced by the system without indicating an error.

RETURN VALUES

Since sigpause() and sigsuspend() suspend process execution indefinitely, there is no successful completion return value. On failure, these functions return -1 and set errno to indicate the error.

ERRORS

EINTR
    A signal is caught by the calling process and control is returned from the signal-catching function.

SEE ALSO
sigblock(2), sigpending(2V), sigprocmask(2V), sigvec(2), pause(3V), sigaction(3V), signal(3V), sigsetops(3V)