struct sigaction:
struct sigaction {
void (*sa_handler)(int); /* addr of signal handler, */
/* or SIG_IGN, or SIG_DFL */
sigset_t sa_mask; /* additional signals to block */
int sa_flags; /* signal options, Figure 10.16 */
/* alternate handler */
void (*sa_sigaction)(int, siginfo_t *, void *);
};
sigprocmask function:
int sigprocmask(int how, const sigset_t *restrict set, sigset_t *restrict oset);
is that both sa_mask
of struct sigaction
and sigprocmask()
function are able to mask the signal? what is the difference?
The mask in struct sigaction
are signals that will be blocked (in the thread the signal handler executes in) while the signal handler is running.
The mask established with sigprocmask() are the signals that will be blocked for the process (and should only be used in a single threaded program)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With