Commit f97f50c2 authored by Martin Sustrik's avatar Martin Sustrik

Signaler timeout bug on Windows fixed

Signed-off-by: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent 1a408805
...@@ -175,13 +175,17 @@ int zmq::signaler_t::wait (int timeout_) ...@@ -175,13 +175,17 @@ int zmq::signaler_t::wait (int timeout_)
FD_ZERO (&fds); FD_ZERO (&fds);
FD_SET (r, &fds); FD_SET (r, &fds);
struct timeval timeout; struct timeval timeout;
if (timeout_ >= 0) {
timeout.tv_sec = timeout_ / 1000; timeout.tv_sec = timeout_ / 1000;
timeout.tv_usec = timeout_ % 1000 * 1000; timeout.tv_usec = timeout_ % 1000 * 1000;
}
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
int rc = select (0, &fds, NULL, NULL, &timeout); int rc = select (0, &fds, NULL, NULL,
timeout_ >= 0 ? &timeout : NULL);
wsa_assert (rc != SOCKET_ERROR); wsa_assert (rc != SOCKET_ERROR);
#else #else
int rc = select (r + 1, &fds, NULL, NULL, &timeout); int rc = select (r + 1, &fds, NULL, NULL,
timeout_ >= 0 ? &timeout : NULL);
if (unlikely (rc < 0)) { if (unlikely (rc < 0)) {
zmq_assert (errno == EINTR); zmq_assert (errno == EINTR);
return -1; return -1;
......
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