change or examine the signal mask of a thread
cc [options] -Kthread file
int thr_sigsetmask(int how, const sigset_t *set, sigset_t *oset);
thr_sigsetmask changes or examines the
calling thread's signal mask
according to the way how and set are set.
If there are any pending unblocked signals
after the call to thr_sigsetmask,
at least one of those signals will be delivered
before the call to thr_sigsetmask returns.
In this implementation,
changing the signal mask of the thread
will also change the signal mask of the lightweight process (LWP)
running the thread.
SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK
pointer to a set of signals to be blocked or unblocked
pointer to the value of the
previous signal mask (set by thr_sigsetmask)
how determines how set is interpreted.
Set how to one of the following values:
Note that 0 is not a valid value for how.
Add the set of signals denoted by set
to the current signal mask
Remove the set of signals denoted by set
from the current signal mask
Replace the current signal mask
with the set of signals denoted by set
set 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 described
If set is NULL,
the value of how is not significant,
and the thread's signal mask will not be changed.
It is not possible to block those signals that cannot be ignored
this restriction is silently imposed by the system.
If oset is not NULL,
thr_sigsetmask stores the value of the previous mask
in that location.
If set is NULL and oset is not NULL,
oset will point to the value of the thread's current signal mask.
thr_sigsetmask returns zero for success
and an error number for failure, as described below.
If thr_sigsetmask fails, the thread's signal mask is not changed.
If any of the following conditions occurs,
thr_sigsetmask returns the corresponding value:
The value of how is not equal to one of the defined values.
Threads should use thr_sigsetmask rather than
In some implementations,
sigprocmask can be trapped and behaves identically to thr_sigsetmask,
but for portability, thr_sigsetmask should be used.
In this implementation,
an application running multiplexed threads with different signal masks
can observe a performance degradation.
Therefore, for optimal performance,
all multiplexing threads in a process
should use the same signal mask.
Applications needing threads
that will run frequently
with signal masks different from other threads in the process
should consider creating those threads as bound threads
for better performance.
The preferred coding style
is to mask all signals and use sigwait synchronously.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004