Commit f5e6d679 authored by Martin Sustrik's avatar Martin Sustrik

Timeout in zmq_poll is in milliseconds

The old timeout in microsecond haven't been compliant with
POSIX and was impractical at the same time.
Signed-off-by: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent e3cf6e9c
......@@ -41,7 +41,7 @@ member, and then indicate any requested events that have occurred by setting the
bit corresponding to the event condition in the 'revents' member.
If none of the requested events have occurred on any *zmq_pollitem_t* item,
_zmq_poll()_ shall wait 'timeout' microseconds for an event to occur on
_zmq_poll()_ shall wait 'timeout' milliseconds for an event to occur on
any of the requested items. If the value of 'timeout' is `0`, _zmq_poll()_
shall return immediately. If the value of 'timeout' is `-1`, _zmq_poll()_ shall
block indefinitely until a requested event has occurred on at least one
......
......@@ -387,10 +387,10 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
if (timeout_ == 0)
return 0;
#if defined ZMQ_HAVE_WINDOWS
Sleep (timeout_ > 0 ? timeout_ / 1000 : INFINITE);
Sleep (timeout_ > 0 ? timeout_ : INFINITE);
return 0;
#else
return usleep (timeout_);
return usleep (timeout_ * 1000);
#endif
}
......@@ -514,7 +514,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// when the polling should time out.
if (first_pass) {
now = clock.now_ms ();
end = now + (timeout_ / 1000);
end = now + timeout_;
if (now == end)
break;
first_pass = false;
......@@ -540,10 +540,10 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
if (timeout_ == 0)
return 0;
#if defined ZMQ_HAVE_WINDOWS
Sleep (timeout_ > 0 ? timeout_ / 1000 : INFINITE);
Sleep (timeout_ > 0 ? timeout_ : INFINITE);
return 0;
#else
return usleep (timeout_);
return usleep (timeout_ * 1000);
#endif
}
......@@ -695,7 +695,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// when the polling should time out.
if (first_pass) {
now = clock.now_ms ();
end = now + (timeout_ / 1000);
end = now + timeout_;
if (now == end)
break;
first_pass = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment