__THRSIGDIVERT(2) FreeBSD System Calls Manual __THRSIGDIVERT(2)
NAME
__thrsigdivert - synchronously accept a signal
SYNOPSIS
#include <sys/time.h>
#include <signal.h>
int
__thrsigdivert(sigset_t set, siginfo_t *info,
const struct timespec *timeout);
DESCRIPTION
The __thrsigdivert() function is used to implement sigwait(). It selects
a signal pending for the calling thread or process from set, atomically
clears it from that set of pending signals, and returns that signal
number. If prior to the call to __thrsigdivert() 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 becomes pending. The signals
defined by set should have been blocked in all threads in the process at
the time of the call to __thrsigdivert(); otherwise the signal may be
delivered to some thread that does not have it blocked.
If more than one thread is using __thrsigdivert() to wait for the same
signal, no more than one of these threads shall return from
__thrsigdivert() for any given signal that is sent. Which thread returns
from __thrsigdivert() if more than a single thread is waiting is
unspecified.
If the info argument is not NULL, then a siginfo_t will be stored there
which has the selected signal number in its si_signo member and the cause
of the signal in its si_code member.
If the timeout argument is not NULL and no selected signal is currently
pending, then __thrsigdivert() will wait no longer than the specified
time period for a signal to arrive before failing.
RETURN VALUES
If successful, the number of the signal that was accepted is returned.
Otherwise, a value of -1 is returned and errno is set to indicate the
error.
ERRORS
__thrsigdivert() will succeed unless:
[EWOULDBLOCK] The timeout was reached before a selected signal was
received.
SEE ALSO
sigaction(2), sigprocmask(2), sigwait(3)
STANDARDS
The __thrsigdivert() function is specific to OpenBSD and should not be
used in portable applications.
HISTORY
A thrsigdivert() syscall appeared in OpenBSD 3.9. The info and timeout
arguments were added in OpenBSD 4.9.
AUTHORS
The thrsigdivert() syscall was created by Ted Unangst <
[email protected]>.
This manual page was written by Philip Guenther <
[email protected]>.
FreeBSD 14.1-RELEASE-p8 February 22, 2023 FreeBSD 14.1-RELEASE-p8