sigpause(2)
NAME
sigpause − atomically release blocked signals and wait for interrupt
SYNOPSIS
#include <signal.h>
long sigpause(long mask);
DESCRIPTION
sigpause() blocks signals according to the value of mask in the same manner as sigsetmask(2), then atomically waits for an unmasked signal to arrive. On return sigpause() restores the current signal mask to the value that existed before the sigpause() call. When no signals are to be blocked, a value of 0L is used for mask.
In normal usage, a signal is blocked using sigblock() (see 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().
RETURN VALUE
sigpause() terminates when it is interrupted by a signal. When sigpause() terminates, it returns −l and sets errno to EINTR.
EXAMPLES
The following call to sigpause() waits until the calling process receives a signal:
sigpause (0L);
The following example blocks the SIGIO signal until sigpause() is called. When a signal is received at the sigpause() statement, the signal mask is restored to its value before sigpause() was called:
long savemask;
savemask = sigblock (sigmask (SIGIO));
/∗ critical section ∗/
sigpause (savemask);
WARNINGS
Check all references to signal(5) for appropriateness on systems that support sigvector(2). sigvector() can affect the behavior described on this page.
Do not use sigpause() in conjunction with the facilities described under sigset(2V).
AUTHOR
sigpause() was developed by the University of California, Berkeley.
SEE ALSO
sigblock(2), sigsetmask(2), sigsuspend(2), sigvector(2).
Hewlett-Packard Company — HP-UX Release 9.0: August 1992