[Twisted-Python] reactor.stop() won't, threads and Queue to blame?
bv at bnl.gov
Mon Oct 25 12:41:12 EDT 2004
Andrew Bennetts <andrew-twisted at puzzling.org> writes:
> Yep, that's the problem here. Change this:
> to this:
> reactor.callFromThread(d.callback, meth(*a, **k))
> (Or perhaps less confusingly:
> result = meth(*a, **kw)
> reactor.callFromThread(d.callback, result)
Yes, that did it.
> There's no reason why Deferreds wouldn't work in another thread, if that's
> what you want. It's just that generally it's not what you want...
In this case the Deferred is used as a return value for Twisted's
XML-RPC server implementation. I go to this trouble of a CommandQueue
because my system blurs the distinction between server and client and
this was leading to deadlocks. This CommandQueue should make sure
that all the troublesome communications are atomic.
Thanks to both you and Clark for your help.
More information about the Twisted-Python