EventLoop shutdown procedure..

From: Robert Collins <robertc@dont-contact.us>
Date: Mon, 21 Aug 2006 22:17:43 +1000

I'd like to make the shutdown procedure async as well - allowing things
like swap log writing to use calls elsewhere in the codebase that are
async - like the disk engines.

Heres my proposed api:
 - on EventLoop you can call addShutdownEvent(callback, callbackdata);
 - this builds up a vector of pending shutdown callbacks.
 - when the event loop detects its time to stop - i.e. because its had
stop() called, or because its gone idle, it invokes the last registered
callback. This has a signature like 'void SHUTDOWNEVENT(callback,
callbackdata);'. The event loop will invoke it with the loop as the
callback data - so when that routine completes, the loop will move onto
the next shutdown event and so on.
 - When the last shutdown event returns, the loop will return to the
caller of run().

This has a couple of ramifications:
 - we'll need to teach various layers like comms that there core can be
shutdown *while* the event loop is still running - but this is
conceptually quite easy IMO.
 - we'll have a mismatch between some parts of reconfigure and this
approach, for a but - but thats reasonably easy to deal with in the
short term. Long term, if reconfigure becomes async itself it will be
non problematic.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Received on Mon Aug 21 2006 - 06:17:44 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Sep 01 2006 - 12:00:03 MDT