sigwait()

wait for a pending signal 

Function


SYNOPSIS

#include <signal.h>

int sigwait(const sigset_t *set, int *sig);


DESCRIPTION

The sigwait() function selects a pending signal from set, atomically clears it from the system's set of pending signals, and returns that signal number in the location referenced by sig. If no signal in set is pending at the time of the call, the thread is suspended until one or more becomes pending. The signals defined by set are blocked at the time of the call to sigwait(); otherwise the behavior is undefined. The effect of sigwait() on the signal actions for signals in set is unspecified.

If more than one thread is using sigwait() to wait for the same signal, no more than one of these threads returns from sigwait() with the signal number. Which thread returns from sigwait() if more than a single thread is waiting is unspecified.

Should any of the multiple pending signals be in the range SIGRTMIN to SIGRTMAX, the lowest numbered one is delivered first. The selection order between realtime and non-realtime signals is unspecified.


PARAMETERS

set 

Specifies the set of signals to wait for.

sig 

Is the address into which the signal number of the received signal is stored.


RETURN VALUES

sigwait() stores the signal number of the received signal in the location specified by sig and returns 0. On failure, it returns -1 and sets errno to one of the following values:

EFAULT 

sig or set are an invalid pointer.

EINVAL 

The set argument contains an invalid or unsupported signal number.


CONFORMANCE

POSIX.1 (1996)


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

api_intro

Functions:
pause(), sigaction(), signal(), sigpause(), sigpending(), sigwaitinfo()


PTC MKS Toolkit 10.4 Documentation Build 39.