chiark / gitweb /
python: Refactoring of I/O events and suchlike.
There are a number of problems with the current arrangement.
* The service manager main loop is tied to getting I/O events through
mLib. There's a new service coming up which wants to collect D-Bus
signals, and that involves using the glib event loop instead.
* Some services seem to (still) have coroutine scheduling bugs:
they're calling functions from the wrong coroutine. The utilities
in tripemon would be useful, but they're tied to the glib event
loop.
So here's the proposed fix.
* SelCommandDispatcher is a mistake. Split its functionality out into
a separate class which can be plugged into TripeConnection or one of
its descendants, so that clients which want a glib-based dispatcher
can replace it without having to overturn the class hierarchy.
* Move the scheduling utilities (`idly', `aside') from tripemon into
tripe.py. Make them available from services by providing a main
loop in TripeConnection.
A few more wrinkles.
* `idly' is renamed `defer' because that's what it does now: rather
than waiting until there are no events incoming, it clears the decks
of all deferred operations before looking for more events.
* The interface of `spawn' has changed. You provide a function to
call in a new coroutine rather than a freshly minted coroutine that
needs hacking. All uses of `spawn' fit this pattern, so it's not a
big deal, but it's worth mentioning.