cc [options] -Kthread file
int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
If there are any pending unblocked signals after the call to pthread_sigmask, at least one of these signals will be delivered before the call to pthread_sigmask returns.
If pthread_sigmask fails, the thread's signal mask is not changed.
It is not possible to block those signals that cannot be ignored (see sigaction(2)); this restriction is silently imposed by the system.
If any of the SIGFPE, SIGILL, SIGSEGV, or SIGBUS signals are generated while they are blocked, the result is undefined, unless the signal was generated by a function capable of sending a signal to a specific process or thread.
The how parameter determines how set is interpreted. how must be one of the following values:
Note that 0 is not a valid value for how.
The set parameter can be NULL or a pointer to a sigset_t. If set is NULL, the value of how is not significant, and the thread's signal mask will not be changed. Thus, the call can be used to inquire about currently blocked signals.
If set is not NULL, it points to a set of signals to be blocked or unblocked (according to the value of how) in the current thread. set is usually constructed with the routines sigemptyset(3C), sigfillset(3C), sigaddset(3C), sigdelset(3C), and sigismember(3C), which are described on sigsetops(3C).
The oset parameter can be NULL or not NULL. If oset is not NULL, pthread_sigmask stores the value of the previous mask in that location. If oset is not NULL and set is NULL, oset will point to the value of the thread's current signal mask.
Some applications cannot avoid assigning different signal masks to threads; in such cases, performance may be improved by creating those threads as bound (PTHREAD_SCOPE_SYSTEM) threads.