Select a pending signal
#include <sys/neutrino.h>
int SignalWaitinfo( const sigset_t* set,
siginfo_t* info );
int SignalWaitinfo_r( const sigset_t* set,
siginfo_t* info );
- set
- A pointer to a sigset_t object that specifies the
signals you want to wait for.
- info
- NULL, or a pointer to a
siginfo_t
structure where the function can store information about the signal.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The SignalWaitinfo() and SignalWaitinfo_r()
kernel calls select the pending signal from the set specified by set.
If no signal in set is pending at the time of the call, the thread blocks until one or
more signals in set become pending or until interrupted by an
unblocked, caught signal.
These functions are identical except in the way they indicate errors.
See the Returns section for details.
 |
- Instead of using these kernel calls directly, consider calling
sigwaitinfo().
- If you don't block the signals before calling this function,
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:
- Install a signal handler that sets a flag.
- Block the signal.
- Check if the flag is set.
- Call SignalWaitinfo().
|
If the info argument isn't NULL,
information on the selected signal is stored there as follows:
siginfo_t member |
Description |
si_signo |
Selected signal number |
si_code |
Signal code |
si_value |
Signal value |
If, while SignalWaitinfo() is waiting, a caught signal
occurs that isn't blocked, the signal handler is invoked and
SignalWaitinfo() is interrupted with an error of
EINTR.
- STATE_SIGWAITINFO
- The calling thread blocks waiting for a signal.
A signal number. If an error occurs:
- SignalWaitinfo() returns -1 and sets
errno.
- SignalWaitinfo_r() returns the negative of a value from
the Errors section and doesn't set errno.
- EINTR
- The call was interrupted by a signal.
- EFAULT
- A fault occurred when the kernel tried to access the buffers provided.
- ETIMEDOUT
- A kernel timeout unblocked the call. See
TimerTimeout().
QNX Neutrino
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
siginfo_t,
SignalKill(),
SignalKill_r(),
sigwaitinfo()