thr_sigsetmask(3thread) thr_sigsetmask(3thread)
NAME
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);
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)
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.
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
Copyright 1994 Novell, Inc. Page 1
thr_sigsetmask(3thread) thr_sigsetmask(3thread)
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.
USAGE
Portability Considerations
Threads should use thr_sigsetmask rather than sigprocmask(2).
In some implementations, sigprocmask may 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 may 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.
Copyright 1994 Novell, Inc. Page 2
thr_sigsetmask(3thread) thr_sigsetmask(3thread)
Style Considerations
The preferred coding style is to mask all signals and use
sigwait synchronously.
REFERENCES
kill(2), sigaction(2), signal(5), sigprocmask(2), sigsend(2),
sigsetops(3C), sigwait(2), thr_kill(3thread), thread(3thread)
Copyright 1994 Novell, Inc. Page 3