[zeromq-dev] [PATCH] Precise timeouts in zmq_poll

Martin Lucina mato at kotelna.sk
Wed Oct 13 17:16:47 CEST 2010


Martin,

sustrik at moloch.sk said:
> Here's a patch to master that should prevent zmq_poll exiting when  
> specified timeout is not yet reached.

Looks good. I've not actually tested the code, just read it. Suggest you do
the select() implementation also.

If I read this correctly the semantics change to "zmq_poll() shall never
exit earlier than the specified timeout". It may of course exit a little
later due to the timeout not being precise (first pass, etc...) and as such
I'll then document it so that people don't try to use zmq_poll() as a
timing mechanism.

> Testing and reporting problems is welcome!

zmq_poll() is fairly complex and heavily used by a lot of people; would be
nice to have real regression tests for it. Take a look at what Brian has
done in PyZMQ:

http://github.com/zeromq/pyzmq/blob/master/zmq/tests/test_poll.py

We could port this pretty trivially and add a test_poll, then add also code
to check e.g. the timeout behabviours.

Martin, would you have time for this? It's not much work and would be very
worthwhile...

-mato




More information about the zeromq-dev mailing list