![]() |
![]() |
![]() |
Block signals
#include <unix.h> int sigblock( int mask );
libc
The sigblock() function adds the signals specified in mask to the set of signals currently being blocked from delivery. Signals are blocked if the appropriate bit in mask is a 1; the macro sigmask() is provided to construct the mask for a given signum. The sigblock() returns the previous mask. The previous mask may be restored using sigsetmask().
In normal usage, a signal is blocked using sigblock(). To begin a critical section, variables modified on the occurrence of the signal are examined to determine that there's no work to be done, and the process pauses awaiting work by using sigpause() with the mask returned by sigblock().
It isn't possible to block SIGKILL, SIGSTOP, or SIGCONT; this restriction is silently imposed by the system.
The previous set of masked signals.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | Yes |
Signal handler | Yes |
Thread | No |
Use of these interfaces should be restricted to only applications written on BSD platforms. Use of these interfaces with any of the system libraries or in multithreaded applications is unsupported.
kill(), sigaction(), sigmask(), signal(), sigpause(), sigprocmask(), sigsetmask(), sigunblock()
![]() |
![]() |
![]() |