Wait for a specified signal and return its information
#include <signal.h> int sigwaitinfo ( const sigset_t *set, siginfo_t *info );
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The sigwaitinfo() function selects a pending signal from set, atomically clears it from the set of pending signals in the system, and returns that signal number.
The signals defined by set should be blocked before you call sigwaitinfo(). If you don't block them, there's a race condition in that a signal can be delivered just before the call is made, causing the call to block, which you might not want it to do. Note that simply blocking a signal is insufficient, as there's still a race condition where the signal is delivered just before the call to block it is handled. You could do the following:
If there's no pending signal, sigwaitinfo() blocks until the specified signal is pending. If the specified signal is already pending, upon call to sigwaitinfo(), the call immediately returns without blocking.
If info isn't NULL, sigwaitinfo() stores the selected signal in the si_signo member of info, and the cause of the signal in the si_code member.
If any value is queued to the selected signal, the first queued value is dequeued and, if the info argument is non-NULL, the value is stored in the si_value member of info. The system resources used to queue the signal are released and made available to queue other signals. If no value is queued, the content of the si_value member is undefined.
If no further signals are queued for the selected signal, the pending indication for that signal is reset.
A signal number, or -1 if an error occurred (errno is set).
POSIX 1003.1 RTS
pause(), pthread_sigmask(), sigaction(), sigaddset(), sigdelset(), sigemptyset(), sigfillset(), SignalWaitinfo(), sigpending(), sigsuspend(), sigtimedwait(), sigwait()
“Detecting process termination” in the “Processes” chapter of the QNX Neutrino Programmer's Guide