Signal notification

Updated: April 19, 2023

Suppose that, on the other hand, you're performing some kind of work, but don't want that work to go on forever. For example, you may be waiting for some function call to return, but you can't predict how long it takes.

In this case, using a signal as the notification scheme, with perhaps a signal handler, is a good choice (another choice we'll discuss later is to use kernel timeouts; see _NTO_CHF_UNBLOCK in the Message Passing chapter as well). In the “Using timers” section below, we'll see a sample that uses signals.

Note: (QNX Neutrino 7.1 or later) The kernel saves and restores the FPU context on entering and leaving signal handlers, so it's safe to use floating-point operations in them.

Alternatively, a signal with sigwait() is cheaper than creating a channel to receive a pulse on, if you're not going to be receiving messages in your application anyway.