[Twisted-Python] a problem about iocp and callInThread
Tristan Seligmann
mithrandi at mithrandi.net
Sun May 15 10:26:50 MDT 2011
On Sun, May 15, 2011 at 6:10 PM, Dfgqq Dfgqq <dynamicgl at gmail.com> wrote:
> reactor.callLater(self.wait, reactor.callInThread, self.Execute)
I believe this should be:
reactor.callFromThread(reactor.callLater, self.wait,
reactor.callInThread, self.Execute)
Execute is not being called in the reactor thread, so the only Twisted
API you are allowed to use is reactor.callFromThread, which schedules
a callable to run in the reactor thread and wakes up the reactor if
necessary. Calling other APIs from a non-reactor thread can result in
various misbehaviours such as delays in event processing, as you are
observing.
--
mithrandi, i Ainil en-Balandor, a faer Ambar
More information about the Twisted-Python
mailing list