[zeromq-dev] External Event Loop

Jonathan Rockway jon at jrock.us
Wed Jan 26 02:23:53 CET 2011

* On Tue, Jan 25 2011, Martin Sustrik wrote:
> Hi Praveen,
>> Actually when sockets are created and bound/connected they are not ready
>> for polling using ZMQ_FD.
> What does it exactly mean? Does the program crash in such case or what?

Also, FWIW, I do not get this behavior with 2.1.0+ (and haven't tried it
with earlier versions, as the docs say it's not going to work anyway).
I have a somewhat complex set of apps that all communicate via zmq
running in an EV event loop (with lots of other EV watchers in each
app), and it all works beautifully; I've never had any problems at all.
I've written test cases for the various edge cases (trying to write when
ZMQ_HWM + ZMQ_SNDBUF are hit), and everything works fine.  (In that
case, ZMQ_EVENTS indicates no writability, so I make a write watcher,
when the watcher is activated, I check ZMQ_EVENTS again, and then try
the write if writability is indicated.  This always works.)

What I have not done is try this with zmq < 2.1.0, or read the code for
that.  (I've looked at the ZMQ_FD + ZMQ_EVENTS related code in the git
version, and it all works like I would expect.)  Is ZMQ_FD even supposed
to be used for external event loops pre-2.1.0?

(I'm confused because I've read the mongrel2 source code, and still
don't really understand how Zed integrates ZMQ into his superpoll event
loop.  But it works really well, so I'll assume that I'm missing some
detail there.)

Jonathan Rockway

print just => another => perl => hacker => if $,=$"

More information about the zeromq-dev mailing list