Multithreaded Programming Guide

Exit Print View

Updated: July 2014
 
 

Access the Signal Mask of the Calling Thread

Use thr_sigsetmask(3C) to change or examine the signal mask of the calling thread.

thr_sigsetmask Syntax

#include <thread.h>
#include <signal.h>
int thr_sigsetmask(int how, const sigset_t *set, 
          sigset_t *oset);

thr_sigsetmask() changes or examines a calling thread's signal mask. Each thread has its own signal mask. A new thread inherits the calling thread's signal mask and priority. However, pending signals are not inherited. Pending signals for a new thread will be empty.

If the value of the argument set is not NULL, set points to a set of signals that can modify the currently blocked set. If the value of set is NULL, the value of how is insignificant and the thread's signal mask is unmodified. Use this behavior to inquire about the currently blocked signals.

The value of how specifies the method in which the set is changed. how takes one of the following values.

  • SIG_BLOCK. set corresponds to a set of signals to block. The signals are added to the current signal mask.

  • SIG_UNBLOCK. set corresponds to a set of signals to unblock. These signals are deleted from the current signal mask.

  • SIG_SETMASK. set corresponds to the new signal mask. The current signal mask is replaced by set.

thr_sigsetmask Return Values

Upon successful completion, thr_sigsetmask() returns 0. When any of the following conditions is detected, thr_sigsetmask() fails and returns the corresponding value.

EINVAL

Description: set is not NULL and the value of how is not defined.