Blocks the calling thread until a specified signal is received.
Threads Library (libpthreads.a)
The sigwait subroutine blocks the calling thread until one of the signal in the signal set set is received by the thread. sigwait returns an EINVAL error if it attempts to wait on SIGKILL(9), SIGSTOP(17), or SIGWAITING(39–AIX-specific).
The signal can be either sent directly to the thread, using the pthread_kill subroutine, or to the process. In that case, the signal will be delivered to exactly one thread that has not blocked the signal.
Concurrent use of sigaction and sigwait subroutines on the same signal is forbidden.
Item | Description |
---|---|
set | Specifies the set of signals to wait on. |
sig | Points to where the received signal number will be stored. |
Upon successful completion, the received signal number is returned via the sig parameter, and 0 is returned. Otherwise, an error code is returned.
The sigwait subroutine is unsuccessful if the following is true:
Item | Description |
---|---|
EINVAL | The set parameter contains an invalid or unsupported signal number. |