[Twisted-Python] cleanup at reactor.stop
Ümit Öztosun
umit.oztosun at gmail.com
Mon Apr 4 08:20:43 MDT 2005
Adding something like:
reactor.addSystemEventTrigger('before', 'shutdown', methodToRunBeforeShutdown)
before running reactor.run() should do the work.
Regards,
Umit
> >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".
More information about the Twisted-Python
mailing list