Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (s and S) sigwait(2)
NAME
sigwait - Causes the calling thread to wait for a signal
LIBRARY
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/yputdll
SYNOPSIS
#include <signal.h>
int 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.
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 sigwait() function is a cancellation point.
The thread-aware signal is always enabled in the POSIX User Thread (PUT) library so that exter-
nally generated signals (such as SIGINT, SIGQUIT, SIGALRM, and SIGCHLD) are catchable
by threads.
NOTES
The sigwait() function is not supported for non-threaded applications.
To use the sigwait() functionality in a threaded application that uses the Standard POSIX
Threads library, see spt_sigwait(2).
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running H06.21 or later RVUs or J06.10 or later RVUs, you must perform all of the fol-
lowing tasks to make the function thread-aware in a multi-threaded application:
• Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
• Link the application to the zputdll library (/G/system/zdllnnn/zputdll).
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use
this function with 32-bit or 64-bit threaded applications.
To use this function in a 32-bit threaded application on systems running H06.24 or later RVUs or
J06.13 or later RVUs, perform the same tasks (described above) used to make the function
thread-aware in a multi-threaded application on systems running H06.21/J06.10 or later RVUs.
527186-023 Hewlett-Packard Company 7−109