[zeromq-dev] Using ZMQ_FD with select

john skaller skaller at users.sourceforge.net
Sun Feb 19 14:06:13 CET 2012

On 19/02/2012, at 9:02 PM, Schmurfy wrote:

> Now I really feel stupid xD
> Thanks for pointing this out, not really intuitive.
> I am back to square one since it does not explain my problem then xD
> But I am curious what was your problem with REQ/REP if not this one because I also have problems with REQ/REP where the other sockets type works as intended.
> I just can't pinpoint what exactly is wrong and where.

Somehow my message didn't get posted.

What actually happens is that ZMQ is doing a select itself,
and it loads the message in a background thread so fast that
by the time YOU do the select, there's nothing to read on the fd.

ZMQ has already read it.

You must use zmq_poll. You cannot use select yourself on a fd 
owned by ZMQ, that leads to a race:)

john skaller
skaller at users.sourceforge.net

More information about the zeromq-dev mailing list