summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-07-18 09:41:26 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-07-18 09:41:26 +0200
commitf97f50c252adc814145a0a482bc2a25229882459 (patch)
tree983c2c1f4682c17a07f61f400618f6101dfe3cec
parent1a408805521f839e3e36183d9f2dec1d08e24caf (diff)
Signaler timeout bug on Windows fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r--src/signaler.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/signaler.cpp b/src/signaler.cpp
index 8778d1a..4803f61 100644
--- a/src/signaler.cpp
+++ b/src/signaler.cpp
@@ -175,13 +175,17 @@ int zmq::signaler_t::wait (int timeout_)
FD_ZERO (&fds);
FD_SET (r, &fds);
struct timeval timeout;
- timeout.tv_sec = timeout_ / 1000;
- timeout.tv_usec = timeout_ % 1000 * 1000;
+ if (timeout_ >= 0) {
+ timeout.tv_sec = timeout_ / 1000;
+ timeout.tv_usec = timeout_ % 1000 * 1000;
+ }
#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);
#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)) {
zmq_assert (errno == EINTR);
return -1;