sigblock
Purpose
Blocks signals.
Syntax
int sigblock (mask)
int mask;
Description
The sigblock system call causes the signals specified by
the mask parameter to be added to the set of signals cur-
rently being blocked from delivery. The signals are
blocked from delivery by logically OR-ing the mask param-
eter into the process's signal mask. Signal i is blocked
if the i-th bit in mask is a 1.
&c2del. It is not possible to block SIGKILL. &c2off.
&c2ins. It is not possible to block SIGKILL or SIGSAK.
&c2off. The system provides no indication of this
restriction.
Typically, the sigblock system call is used to block
signals during a critical section of code, and then
sigsetmask is called to restore the mask to the previous
value returned by sigblock.
Return Value
Upon completion, the previous set of masked signals is
returned.
Example
The following example sets the signal mask to block
SIGINT from delivery, in addition to the signals that are
already blocked:
#include <signal.h>
int prevmask;
. . .
prevmask = sigblock (1 << (SIGINT - 1));
Related Information
In this book: "kill," "signal," "sigvec," and
"sigsetmask."