thr_sigsetmask(3thread)
thr_sigsetmask --
change or examine the signal mask of a thread
Synopsis
cc [options] -Kthread file
#include <thread.h>
int thr_sigsetmask(int how, const sigset_t *set, sigset_t *oset);
Description
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.
Parameters
how-
SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK
set-
pointer to a set of signals to be blocked or unblocked
oset-
pointer to the value of the
previous signal mask (set by thr_sigsetmask)
how parameter
how determines how set is interpreted.
Set how to one of the following values:
SIG_BLOCK-
Add the set of signals denoted by set
to the current signal mask
SIG_UNBLOCK-
Remove the set of signals denoted by set
from the current signal mask
SIG_SETMASK-
Replace the current signal mask
with the set of signals denoted by set
Note that 0 is not a valid value for how.
set parameter
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
on
sigsetops(3C).
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
(see
sigaction(2));
this restriction is silently imposed by the system.
oset parameter
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.
Return values
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.
Errors
If any of the following conditions occurs,
thr_sigsetmask returns the corresponding value:
EINVAL-
The value of how is not equal to one of the defined values.
Portability considerations
Threads should use thr_sigsetmask rather than
sigprocmask(2).
In some implementations,
sigprocmask can be trapped and behaves identically to thr_sigsetmask,
but for portability, thr_sigsetmask should be used.
Performance considerations
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.
Style considerations
The preferred coding style
is to mask all signals and use sigwait synchronously.
References
Intro(3thread),
kill(2),
sigaction(2),
signal(5),
sigprocmask(2),
sigsend(2),
sigsetops(3C),
sigwait(2),
thr_kill(3thread)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004