[zeromq-dev] Connected Twisted to ZeroMQ 2.1.0 (pyzmq 2.1.0dev)

Martin Sustrik sustrik at 250bpm.com
Sun Dec 5 08:24:26 CET 2010


On 12/05/2010 01:02 AM, jeremy avnet wrote:
> On Dec 4, 2010, at 2:44 PM, jeremy avnet wrote:
>
>> If so, what's happening is the trigger comes and goes before Twisted has a chance to see it. I can make this happen all the time if I throw in a sleep between when the data comes in and I return control back to the Twisted reactor.
>
> Looks a bit more complicated than this. The select() affects the FD trigger status. If I stop inspecting the FD then the XREQ always works, even if I throw in the sleep. However, the REQ never works.
>
> By doing select() and EVENTS inspection on the REQ FD, I can see the FD does get triggered and EVENTS gets set, but Twisted isn't seeing it.

It's edge-trigerred, meaning that ZMQ_FD becomes signaled only once when 
any number of messages is received. You can read all the messages but 
ZMQ_FD won't get signaled again until you fail to get another message 
(either ZMQ_EVENTS returning !ZMQ_POLLIN or recv() returning EAGAIN). At 
that point the whole thing starts from the beginning.

Martin



More information about the zeromq-dev mailing list