SIGWAIT(3) BSD Programmer's Manual SIGWAIT(3)
sigwait - synchronously accept a signal
#include <signal.h>
int
sigwait(const sigset_t *set, int *sig);
The sigwait() function selects a pending signal from set, atomically
clears it from the system's set of pending signals, and returns that sig-
nal number in the location referenced by sig. If prior to the call to
sigwait() there are multiple pending instances of a single signal number,
it is undefined whether upon successful return there are any remaining
pending signals for that signal number. If no signal in set is pending at
the time of the call, the thread shall be suspended until one or more be-
comes pending. The signals defined by set should have been blocked at the
time of the call to sigwait(); otherwise the behaviour is undefined. The
effect of sigwait() on the signal actions for the signals in set is un-
specified.
If more than one thread is using sigwait() to wait for the same signal,
no more than one of these threads shall return from sigwait() with the
signal number. Which thread returns from sigwait() if more than a single
thread is waiting is unspecified.
Note: Code using the sigwait() function must be compiled and linked with
the -pthread option to gcc(1).
Upon successful completion, sigwait() stores the signal number of the re-
ceived signal at the location referenced by sig and returns zero.
On error, sigwait() returns one of these error values:
[EINVAL] The set argument contains an invalid or unsupported signal
number.
sigaction(2), sigpending(2), sigsuspend(2), pause(3), pthread_sigmask(3),
pthreads(3)
sigwait() conforms to ISO/IEC 9945-1:1996 ("POSIX").
MirOS BSD #10-current August 20, 1998 1
Generated on 2013-04-27 00:20:00 by $MirOS: src/scripts/roff2htm,v 1.77 2013/01/01 20:49:09 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2013 The MirOS Project, Germany.
This product includes material
provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.