sigtimedwait(2P4) sigtimedwait(2P4)
NAME
sigtimedwait, sigwaitrt - wait for signals
SYNOPSIS
#include <sys/siginfo.h>
int sigtimedwait(set, info, timeout)
const sigsett *set;
siginfot *info;
const struct timespec *timeout;
int sigwaitrt(set, info)
const sigsett *set;
siginfot *info;
DESCRIPTION
The sigtimedwait function selects the pending signal from
the set specified by set with the lowest numeric signal
value. If no signal in set is pending at the time of the
call, the calling process is suspended until one or more
signals become pending, or until it is interrupted by a sig-
nal, or until the time interval specified in the timespec
structure has elapsed. If the timespec structure pointed to
by timeout is zero-valued and if none of the signals speci-
fied by set are pending, then sigtimedwait returns immedi-
ately with an error. If timeout is the NULL pointer, the
function will wait indefinitely.
If the info argument is not NULL, the selected signal number
is stored in the sisigno member, and the cause of the sig-
nal is stored in the sicode member. If any value is queued
to the selected signal, the first such queued value is
dequeued and, if the info argument is non-NULL, the value is
stored in the sivalue member of info. The system resources
used to queue the signal are released. If no value is
queued, the content of the sivalue member is undefined. If
no further signals are queued for the selected signal
number, the pending indication for that signal is reset.
The sigwaitrt function is equivalent to sigtimedwait with a
NULL third argument.
If, while sigtimedwait or sigwaitrt is waiting, a signal
occurs which is eligible for delivery (i.e., not blocked by
the process signal mask), that signal is handled asynchro-
nously and the wait is interrupted or, if the SARESTART
flag was used with sigaction(2), restarted.
RETURN VALUE
Upon successful completion (that is, one of the signals
specified by set is pending or is generated), sigtimedwait
and sigwaitrt return the selected signal number. Otherwise
Page 1 CX/UX Programmer's Reference Manual
sigtimedwait(2P4) sigtimedwait(2P4)
a value of -1 is returned and errno is set to indicate the
error.
ERRORS
If any of the following conditions occur, the sigtimedwait
and sigwaitrt functions will return -1 and set errno to the
corresponding value:
EINTR The wait was interrupted by an unblocked,
caught signal.
EFAULT One of the set, info, or timeout arguments
pointed to an invalid memory address.
If any of the following conditions occur, the sigtimedwait
function will return -1 and set errno to the corresponding
value:
EAGAIN No signal specified by set was delivered
within the specified timeout period.
If any of the following conditions are detected, the
sigtimedwait function will return -1 and set errno to the
corresponding value:
EINVAL The timeout argument specified a nanosecond
value less than zero or greater than or equal
to 1000 million.
FILES
Use of this function requires that the library
/usr/lib/libposix4.a be linked with the application.
SEE ALSO
sigaction(2), sigpending(2), sigprocmask(2), sigsuspend(2),
signal(5).
NOTES
sigwaitrt is implemented as a macro defined in <signal.h>.
A library implementation is visible if that header file is
not included or if that macro is undefed after the header
file is included.
WARNING
The interfaces to sigtimedwait and sigwaitrt are based on
IEEE Draft Standard P1003.4/D12. This is an unapproved
draft, subject to change. Use of information contained in
this unapproved draft is at your own risk. These interfaces
will change to reflect any changes made by future drafts of
POSIX 1003.4.
Page 2 CX/UX Programmer's Reference Manual