[Twisted-Python] reactor.callLater() or reactor.callFromThread() when sending msg just before quit

Gabriel Rossetti gabriel.rossetti at arimaz.com
Tue Dec 8 05:50:47 MST 2009


Hello everyone,

I have to send a message just before my service quits, but sometimes the 
reactor quits before the msg is sent.
I was wondering if I should user reactor.callLater like so :

self.sendMessage(msg)
reactor.callLater(1, self.stop)

(which I don't really like), or use reactor.callFromThread like so :

self.sendMessage(msg)
reactor.callFromThread(self.stop)

(self.stop calls reactor.stop at some point).

I really need for that msg to be sent before the reactor shuts down.

Thank you,
Gabriel




More information about the Twisted-Python mailing list