[zeromq-dev] zmq_poll: timeout issue
Matt Weinstein
matt_weinstein at yahoo.com
Tue Aug 10 16:07:19 CEST 2010
This is the same problem as pthread condition variables have, e.g.:
http://www.justsoftwaresolutions.co.uk/threading/condition-variable-spurious-wakes.html
Just think of the revents as condition variables to check...
Does someone want to write a quick wrapper ?
PS I recommend CLOCK_MONOTONIC, but it may not be available, and
requires -lrt ...
On Aug 10, 2010, at 9:39 AM, Martin Lucina wrote:
> Hi,
>
> ilejncs at narod.ru said:
>> I am observing rather strange zmq_poll behavior.
>> It is triggered by timeout and works fine if -1.
>
> This is a known issue with the current zmq_poll() implementation. The
> zmq_poll(3) documentation mentions this, albeit briefly:
>
> Important
> The zmq_poll() function may return before the timeout period
> has
> expired even if no events have been signaled.
>
> The solution at the moment is either to use an infinite timeout, or
> manage
> the timeout yourself (i.e. call gettimeofday(), recalculate remaining
> timeout and restart the zmq_poll()).
>
> There is a work in progress branch of the code not ready for public
> consumption yet which will contain a new zmq_poll() implementation
> with
> proper timeout handling.
>
> -mato
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
More information about the zeromq-dev
mailing list