SIGPAUSE(2)

NAME
sigpause - suspend process until a signal arrives

SYNOPSIS
#include <signal.h>

int sigpause(long int mask);

DESCRIPTION
sigpause suspends execution of the calling process until a signal arrives. The mask parameter is assigned to the set of blocked signals (see sigsetmask(2)), and then the process is paused. When a signal arrives, the regular signal handler (if any) is executed, and then the original signal mask is restored before returning to the caller. Usually mask is zero to pause until any signal arrives.

sigpause is normally used in situations where one must protect a critical section. A typical use begins with sigblock to block a signal (and enable mutual exclusion); variables modified on the occurance of that signal are then manipulated, code is executed, etc. To end the critical section and wait for more work, sigpause is called.

RETURN VALUE
sigpause always returns an error (-1) and sets errno to EINTR.

SEE ALSO
signal(2), sigblock(2), sigsetmask(2)