[zeromq-dev] zmq_poll: timeout issue
mato at kotelna.sk
Tue Aug 10 16:17:51 CEST 2010
matt_weinstein at yahoo.com said:
> This is the same problem as pthread condition variables have, e.g.:
> 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.
More information about the zeromq-dev