class documentation
class Mainloop(object):
Generic mainloop for daemons
Method | __init__ |
Constructs a new Mainloop instance. |
Method |
|
Registers a receiver for signal notifications |
Method |
|
Runs the mainloop. |
Instance Variable | awaker |
Undocumented |
Method | _ |
Calls all signal waiters for a certain signal. |
Constant | _SHUTDOWN |
Undocumented |
Instance Variable | _signal |
Undocumented |
Registers a receiver for signal notifications
The receiver must support a "OnSignal(self, signum)" function.
Parameters | |
owner:instance | Receiver |
@utils.SignalHandled( [ signal.SIGCHLD])
@utils.SignalHandled( [ signal.SIGTERM])
@utils.SignalHandled( [ signal.SIGINT])
def Run(self, shutdown_wait_fn=None, signal_handlers=None): ¶
@utils.SignalHandled(
@utils.SignalHandled(
def Run(self, shutdown_wait_fn=None, signal_handlers=None): ¶
Runs the mainloop.
Parameters | |
shutdown | Function to check whether loop can be terminated; important: function must be idempotent and must return either None for shutting down or a timeout for another call |
signal | signal->utils.SignalHandler passed by decorator |