[Twisted-Python] cleanup at reactor.stop

Matt Goodall matt at pollenation.net
Mon Apr 4 10:00:52 EDT 2005

Henning.Ramm at mediapro-gmbh.de wrote:

>This is probably a stupid question, but I'm stuck...
>I need to clean up some objects if (that is, before) reactor.stop is called.
>Is there something like reactor.runAtShutdown() or how should I do this?
You can hook into the reactor by registering a system event callback. 
See  twisted.internet.interfaces.IReactorCore's addSystemEventTrigger, 
removeSystemEventTrigger and fireSystemEvent.

You may need to grep the Twisted code to find out all the events that 
are actually fired but the one you want is "shutdown".

- Matt

    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.

More information about the Twisted-Python mailing list