[Twisted-Python] Re: Callback blocked in event loop
general at eepatents.com
Sat Nov 11 01:53:25 EST 2006
> On Fri, 10 Nov 2006 15:24:51 +0000 (GMT), Matt P wrote:
>>> Events may be raised in the server, as a twisted.pb call to
>>> fireEvent on the server and also come in on a separate thread (from
>>> a JMS message queue) and get posted onto the DefferedQueue for
>>> If events are raised in the server, remote listeners get their
>>> pb.Referenceable callback immediately. It works as I would like.
>>> So, only in the case where teh DeferredQueue.put(...) is called
>>> from another thread do I have the problem. I can't see why the
>>> blocking. Does this behaviour make sense to anyone!?
> DeferredQueue isn't threadsafe. Instead of calling put() directly from
> a non-reactor thread, call it with reactor.callFromThread:
> reactor.callFromThread(q.put, value)
Matt, this is exactly the sort of thing for which I wrote the taskqueue
module that is patiently awaiting review in ticket #1768
It is a critical part of my sAsync project ("SQLAlchemy done
asynchronously"). You can check out the latest version as used in that
The part that would appear to be of particular interested to you is the
ThreadQueue subclass of TaskQueue.
More information about the Twisted-Python