Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

spt_sigwait(2) OSS System Calls Reference Manual
NAME
spt_sigwait - Causes the calling thread to wait for a signal
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series and J series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
int spt_sigwait(
sigset_t *set
int *sig);
PARAMETERS
set Specifies the set of signals that the calling thread will wait for.
sig Receives the signal number cleared from the specified set of signal numbers.
DESCRIPTION
This function causes a thread to wait for a signal. It atomically chooses a pending signal from
the set of pending signals indicated by the set parameter, atomically clears that signal from the
system’s set of pending signals, and returns that signal number at the location specified by the sig
parameter. If no signal in set is pending at the time of the call, the thread is blocked until one or
more signals become pending. The signals defined by set should be unblocked during the call to
this function and are blocked when the thread returns from the call, unless another thread is
currently waiting for one of those signals.
A thread must block the signals it waits for using the pthread_sigmask( ) function before calling
this function.
If more than one thread is using this function to wait for the same signal, only one of those
threads returns from this function with the signal number.
A call to the spt_sigwait() function is a cancellation point.
To catch externally generated signals (such as SIGINT, SIGQUIT, SIGALRM, and SIGCHLD) at
the thread level, you must export the SPT_THREAD_AWARE_SIGNAL environmental variable
to the value 1. By default, SPT_THREAD_AWARE_SIGNAL is disabled.
NOTES
To use this function in a threaded application that uses the Standard POSIX Threads library on
systems running J06.10 or later RVUs or H06.21 or later RVUs, you must perform all of the fol-
lowing tasks:
Include the spthread.h header file in the application.
Compile the application using the _SPT_MODEL_ feature test macro or equivalent
compiler command option in addition to any other feature test macros in use.
Link the application to the zsptdll library (/G/system/zdllnnn/zsptdll).
HP recommends that you do not specify threads to wait for process-level signals like SIGCONT,
SGTTIN, SIGTTOU, and SIGSTP. If a thread uses a function like spt_sigwait() or
spt_sigsuspend( ), the thread breaks from the wait state only if the corresponding signal is sent
using the pthread_kill() function. The thread does not break from the wait state for signals that
are generated externally at the process level.
The SIGCHLD signal is delivered to the correct thread even though the SIGCHILD signal is gen-
7422 Hewlett-Packard Company 527186-023