Signal Handling - nthallen/monarch GitHub Wiki
The DAS_IO::Loop::event_loop()
uses pselect(3) in order to safely handle signals. The Loop maintains two signal masks: the blockset and the runset. The blockset blocks signals handled by the Loop, and the runset unblocks those same signals.
There are three key functions for setting up signals:
DAS_IO::Loop::signal(signum, handler)
- sets a signal handler with
::signal()
and also updates the blockset and runset accordingly.
- sets a signal handler with
DAS_IO::Interface::signal(signum, enable=true)
- sets the given Interface to handle the specified signal serially. When the signal is received, the Interface's
serialized_signal_handler()
method will be called. The default implementation will simply exit the event_loop(). - Must be called after the Interface has been added to a Loop, so the call could be logically placed within the Interface's
adopted()
method. - The optional second argument if set to false will disable the signal.
- sets the given Interface to handle the specified signal serially. When the signal is received, the Interface's
DAS_IO::Server::signal(signum)
- sets the Server to handle the specified signal, shutting the server down gracefully. If the server requires some other behavior, you should consider using
DAS_IO::Interface::signal()
instead.
- sets the Server to handle the specified signal, shutting the server down gracefully. If the server requires some other behavior, you should consider using