[zeromq-dev] adding timeout in zmq_poll
pavimus at gmail.com
Mon Dec 28 12:04:05 CET 2009
2009/12/28 Martin Sustrik <sustrik at 250bpm.com>
> Ok. If we choose nanoseconds, there is two moments:
>> 1) Must we add two parameters to zmq_poll(): int timeout_sec, int timeout
> What about using unsigned long and microseconds? Even if ulong resolves to
> 32 bit value, max timeout would be 4295 seconds i.e. more than an hour. That
> should be enough for everyone. Or won't it?
I think this is enough.
> 2) If user specified too small timeout (1 nsec) must we increase this
>> timeout to one ms in linux and 1microsec in windows?
> I would rather decrease the number. The semantics of the timeout is
> "zmq_poll will return before the timeout expires" (see the previous
> discussion on returning with no events).
If specified timeout is greater than OS API timeout granularity we can
without problem decrease it. I speak about case, when user specified timeout
lesser, than timeout granularity in OS API. Timeout will be calculated as
zero and user will get 100% cpu usage in thread that executes zmq_poll() in
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the zeromq-dev