[zeromq-dev] zmq::poll timeout returns immediately on MacOS/X 10.5
matt_weinstein at yahoo.com
Fri Jun 11 00:17:17 CEST 2010
On Jun 10, 2010, at 4:03 PM, Martin Sustrik wrote:
>> I inserted a zmq::poll into the client side of the sample client/
>> 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
> to" timeout interval, i.e. it can return prematurely.
Probably I'd change that to "may wait up to", with a big footnote :-)
> 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?
What would the kernel do? :)
One tack might be one condition variable per user thread, and a high-
priority service thread running a wake-up queue (pointing at a list of
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
More information about the zeromq-dev