NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | RETURN VALUES | ERRORS | ATTRIBUTES | SEE ALSO | NOTES
$(OS_DIR)/lib/libpthreads.a #include <pthread.h> #include <signal.h>int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
The pthread_sigmask() function 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. Signals pending 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. Thus, pthread_sigmask() can be used to inquire about currently blocked signals.
The value of the argument how specifies the method by which the set is changed and takes one of the following values:
set corresponds to a set of signals to block. These signals are added to the current signal mask.
set corresponds to a set of signals to unblock. These signals are deleted from the current signal mask.
set corresponds to the new signal mask. The current signal mask is replaced by set.
If the value of oset is not NULL, it points to the location at which the previous signal mask is stored.
Upon successful completion, the pthread_sigmask() function returns 0. Otherwise, it returns a non-zero value.
The pthread_sigmask() function will fail if:
The value of how is not defined and oset is NULL.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
pthread_create(3POSIX), pthread_join(3POSIX), pthread_self(3POSIX), sigaction(2POSIX), sigprocmask(2POSIX), sigsetops(3POSIX), sigwait(2POSIX), sleep(1M).
It is not possible to block signals that cannot be ignored (see sigaction(2POSIX)). If you are using the threads library, it is not possible to block the signal SIGCANCEL, which is reserved by the threads library. This restriction is enforced by the threads library.
Using sigwait(2POSIX) in a dedicated thread allows asynchronously generated signals to be managed synchronously. However, sigwait() should never be used to manage synchronously generated signals.
Synchronously generated signals are exceptions that are generated by a thread and are directed at the thread causing the exception. Since sigwait() blocks waiting for signals, the blocking thread cannot receive a synchronously generated signal.
Using sigprocmask(2POSIX) in a multi-threaded program, is the same as calling pthread_sigmask(). POSIX leaves the semantics of the call to sigprocmask() unspecified in a multi-threaded process. Therefore, programs that require POSIX portability should not depend on this semantic.
Signals which are generated synchronously should not be masked. If such a signal is blocked and delivered, the receiving process is killed.
A thread directed SIGALRM
generated because of a realtime interval timer or process alarm clock is not maskable by a signal masking function, such as sigprocmask(). See alarm(3STDC ) and setitimer(2).
NAME | SYNOPSIS | API RESTRICTIONS | DESCRIPTION | RETURN VALUES | ERRORS | ATTRIBUTES | SEE ALSO | NOTES