class documentation

class Mainloop(object):

View In Hierarchy

Generic mainloop for daemons

Method __init__ Constructs a new Mainloop instance.
Method RegisterSignal Registers a receiver for signal notifications
Method Run Runs the mainloop.
Instance Variable awaker Undocumented
Method _CallSignalWaiters Calls all signal waiters for a certain signal.
Constant _SHUTDOWN_TIMEOUT_PRIORITY Undocumented
Instance Variable _signal_wait Undocumented
def __init__(self):

Constructs a new Mainloop instance.

def RegisterSignal(self, owner):

Registers a receiver for signal notifications

The receiver must support a "OnSignal(self, signum)" function.

Parameters
owner:instanceReceiver
@utils.SignalHandled([signal.SIGCHLD])
@utils.SignalHandled([signal.SIGTERM])
@utils.SignalHandled([signal.SIGINT])
def Run(self, shutdown_wait_fn=None, signal_handlers=None):

Runs the mainloop.

Parameters
shutdown_wait_fn:callableFunction 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_handlers:dictsignal->utils.SignalHandler passed by decorator
awaker =

Undocumented

def _CallSignalWaiters(self, signum):

Calls all signal waiters for a certain signal.

Parameters
signum:intSignal number
_SHUTDOWN_TIMEOUT_PRIORITY =

Undocumented

Value
-(sys.maxsize-1)
_signal_wait: list =

Undocumented