[zeromq-dev] What are the “serious caveats” with ZMQ_FD?
Dave Lambley
dave.lambley at gmail.com
Mon May 23 18:07:33 CEST 2016
On 23 May 2016 at 10:23, Huttunen, Kalle (GE Healthcare) <
Kalle.Huttunen at ge.com> wrote:
> It seems that sending on the socket makes the ZMQ_FD readable. That in
> turn triggers the calling of the code where I check ZMQ_EVENTS and receive
> everything from the socket. This way I end up checking ZMQ_EVENTS after
> each send.
>
> Is the ZMQ_FD becoming readable when sending on the socket something that
> can be relied on?
>
I believe you have a race condition. If a message arrives after your call
to zmq_recv(), but before your call to select() / poll(), it will block
despite there being a message ready.
If you can tolerate messages being delayed, there is an simple workaround
in which you call zmq_recv() periodically. We have code doing this by
specifying a timeout in the select() call.
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160523/ff1e23f4/attachment.htm>
More information about the zeromq-dev
mailing list