iv_signal provides a way for
applications to handle POSIX signals, by integrating them with the
ivykis event loop.
An ivykis application desiring signal notification registers a
struct iv_signal object by calling
iv_signal_register, after having initialised it with
IV_SIGNAL_INIT and subsequently having filled in the
Once the signal indicated by
->signum is delivered to any thread in the current process, the callback
->handler is scheduled to be called in the thread that the
struct iv_signal object was registered in, with
->cookie as its sole argument.
If the same signal arrives again while the callback function is still
running, the callback function is guaranteed to be called again after
It is permitted to register multiple
struct iv_signal objects for the same signal number. If all such objects are
->flags unset, then all objects will have their callback functions called upon
arrival of the signal, in no guaranteed order.
Invoking callback functions stops at the first
struct iv_signal object with
->flags set, so that if all objects have
IV_SIGNAL_FLAG_EXCLUSIVE set, only one callback function will be invoked.
To deinitialize a
struct iv_signal object, call
iv_signal_unregister from the same thread that
iv_signal_register was called from on that object.
It is permitted to unregister a
struct iv_signal object from any ivykis callback function in the thread it was
registered in, including from a callback function triggered by this
object, and it is permitted to free the memory corresponding to an
unregistered object from its own callback function.
It is guaranteed that signals delivered to child processes that were
but that have not yet called
will not cause
iv_signal callbacks to be invoked in the parent process.
iv_signal is implemented using