[zeromq-dev] zmq::poll timeout returns immediately on MacOS/X 10.5

Martin Sustrik sustrik at 250bpm.com
Thu Jun 10 22:03:18 CEST 2010


Matt,

> I inserted a zmq::poll into the client side of the sample client/server 
> application --
> 
> ...
> 
>     zmq_pollitem_t pi;
>     pi.socket = s;
>     pi.fd = 0;
>     pi.events = ZMQ_POLLIN;
>     pi.revents = 0;
>     assert(zmq::poll(&pi, 1, TIMEOUT) == 0);
> 
>     // inserted before
>     s.recv (&reply);
> 
> ...
> 
> 
> If TIMEOUT is set to -1 this waits for the response, any other value 
> returns immediately.
> 
> Am I missing something?

No. This is a generic issue. Documentation says that function waits "up 
to" timeout interval, i.e. it can return prematurely.

Exact waiting is possible, but it would have performance impact on 
zmq_poll. Others want to have poll as fast as possible, so it's hard 
decision to make.

Thoughts anyone?
Martin



More information about the zeromq-dev mailing list