Signalling

Section Asynchronous notifications provides the high-level description of the mechanism for the delivery of asynchronous notifications (signals). The API defines interfaces for signal transmitters and for the association of signal handlers with entrypoints. An entrypoint can be associated with many signal handlers where each handler usually corresponds to a different signal source. Each signal handler is addressable via a distinct capability. Those so-called signal-context capabilities can be delegated across component boundaries in the same way as RPC-object capabilities. If a component is in possession of a signal-context capability, it can trigger the corresponding signal handler by using a so-called signal transmitter. The signal transmitter provides fire-and-forget semantics for signal submission. Signals serve as mere notifications and cannot carry any payload.

Genode::Signal_transmitter

Genode::Signal_handler

A Signal_handler object is meant to be hosted as a member of the class that also contains a member function to be executed upon the arrival of a signal. Its constructor takes the entrypoint, the signal-handling object, and a pointer to the handling function as arguments. The following example illustrates the common pattern of using a Signal_handler.

 class Main
 {
   ...
   Entrypoint &_ep;
   ...
   void _handle_config();

   Signal_handler<Main> _config_handler =
     { _ep, *this, &Main::_handle_config };
   ...
 };

In the example above, the _config_handler creates a signal-context capability for the _handle_config method. In fact, the _config_handler is a capability since the Signal_handler is derived from Signal_context_capability. Therefore, the _config_handler can be directly passed as argument to an RPC call for registering a signal handler at a server.