[zeromq-dev] zmq_poll: timeout issue

Matt Weinstein matt_weinstein at yahoo.com
Tue Aug 10 16:54:05 CEST 2010


ZMQ_FD and ZMQ_EVENTS appear to return the current status of a socket,  
am I right?

I looked at the poll() code but it looks pretty vanilla, list of  
timers ... except for the cross-thread counter, which would be nice,  
is that what I'm seeing ...?

On Aug 10, 2010, at 10:17 AM, Martin Lucina wrote:

> matt_weinstein at yahoo.com said:
>> 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 ?
>
> I'd wait for the zeromq2/wip-shutdown stuff to hit master. Take a  
> look at
> that branch and you'll get an idea of what's cooking.
>
> The zmq_poll() implementation on that branch is ready for having a  
> strong
> timeout plugged into it, but the other changes there need to settle  
> down
> before I can do that.
>
>> PS I recommend CLOCK_MONOTONIC, but it may not be available, and
>> requires -lrt ...
>
> Yeah, that's why gettimeofday() (and some equivalent I forget right  
> now on
> Win32) is a decent portable alternative.
>
> With the new ZMQ_FD and ZMQ_EVENTS on the wip-shutdown branch you  
> will be
> able to write any kind of poll loop using just plain poll()/ 
> epoll()/... so
> if you hit performance issues you can deal with them.
>
> -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