summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-10-01 13:37:59 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-10-01 13:37:59 +0200
commit2a85cce189ae915e85bb567b1401d063284e622f (patch)
treeddd00941577b644d477230b7185fdee65ed8f297 /src
parent0bb76b667b277b143a9a2901e8bf407f34da469d (diff)
parent8f9080ebb9ea5576c87a1412748aef1faf0653f6 (diff)
Merge branch 'master' of github.com:zeromq/zeromq2
Diffstat (limited to 'src')
-rw-r--r--src/zmq.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/zmq.cpp b/src/zmq.cpp
index 306a85d..6818605 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -412,14 +412,17 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
}
bool first_pass = true;
- int timeout = timeout_ > 0 ? timeout_ / 1000 : -1;
int nevents = 0;
+ if (timeout_ >= 0)
+ timeout_ /= 1000;
+ else
+ timeout_ = -1;
while (true) {
// Wait for events.
while (true) {
- int rc = poll (pollfds, nitems_, first_pass ? 0 : timeout);
+ int rc = poll (pollfds, nitems_, first_pass ? 0 : timeout_);
if (rc == -1 && errno == EINTR) {
free (pollfds);
return -1;
@@ -466,7 +469,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
}
// If there are no events from the first pass (the one with no
- // timout), do at least the second pass so that we wait.
+ // timeout), do at least the second pass so that we wait.
if (first_pass && nevents == 0 && timeout_ != 0) {
first_pass = false;
continue;
@@ -474,7 +477,7 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// If timeout is set to infinite and we have to events to return
// we can restart the polling.
- if (timeout == -1 && nevents == 0)
+ if (timeout_ == -1 && nevents == 0)
continue;
// TODO: if nevents is zero recompute timeout and loop