[zeromq-dev] adding timeout in zmq_poll
sustrik at 250bpm.com
Mon Dec 28 14:17:05 CET 2009
Pavel Gushcha wrote:
> 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 loop.
I don't think that's a problem. If you specify very low timeout, high
CPU usage is to be expected. It's a natural behaviour.
On the other hand, not adhering to timing guarantees can cause serious
problems in real-time applications.
More information about the zeromq-dev