sigemptyset() — Initialize a signal mask to exclude all signals
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
POSIX.1 |
both |
Format
#define _POSIX_SOURCE
#include <signal.h>
int sigemptyset(sigset_t *set);
General description
Initializes a signal set set to the empty set. All recognized signals are excluded.
sigemptyset() is part of a family of functions that manipulate signal sets. Signal sets are data objects that let a process keep track of groups of signals. For example, a process can create one signal set to record which signals it is blocking, and another signal set to record which signals are pending. Signal sets are used to manipulate groups of signals used by other functions (such as sigprocmask()) or to examine signal sets returned by other functions (such as sigpending()).
Returned value
If successful, sigemptyset() returns 0.
There are no documented errno values.
Example
CELEBS17
/* CELEBS17
This example initializes a set of signals to an empty set.
*/
#define _POSIX_SOURCE
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
main() {
struct sigaction sact;
sigemptyset(&sact.sa_mask);
sact.sa_flags = 0;
sact.sa_handler = SIG_IGN;
sigaction(SIGUSR2, &sact, NULL);
puts("before kill()");
kill(getpid(), SIGUSR2);
puts("after kill()");
}
Output
before kill()
after kill()
Related information
- signal.h
- sigaction() — Examine or change a signal action
- sigaddset() — Add a signal to the signal mask
- sigdelset() — Delete a signal from the signal mask
- sigfillset() — Initialize a signal mask to include all signals
- sighold() — Add a signal to a thread
- sigismember() — Test if a signal is in a signal mask
- signal() — Handle interrupts
- sigpause() — Unblock a signal and wait for a signal
- sigpending() — Examine pending signals
- sigprocmask() — Examine or change a thread
- sigset() — Change a signal action or a thread
- sigsuspend() — Change mask and suspend the thread