sigsuspend()

NAME

sigsuspend() - wait for a signal

SYNOPSIS

#include <signal.h>

int sigsuspend(const sigset_t *sigmask)

DESCRIPTION

The sigsuspend(2) function replaces the current signal mask with the set pointed to by sigmask, and then waits for a signal to arrive; on return it returns the previous set of masked signals. The signal mask set is usually empty to indicate that all signals are to be unblocked for the duration of the call.

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

RETURN VALUES

If the sigsuspend(2) call returns, it returns -1 and sets errno

ERRORS

The sigsuspend(2) function always terminates by being interrupted; it sets errno to this value:

[EINTR]
An interrupt signal was received.

SEE ALSO

pause(2)

sigprocmask(2)

sigaction(2)