summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gudrian <christian.gudrian@fluidon.com>2010-10-09 19:19:50 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-10-09 19:19:50 +0200
commitf5030a93a52fc73292c16dae5f8e0e1b39732df0 (patch)
tree910e313bc50bcbe919fd4ef154f7e4a7aebbc791
parent318cdd1f24cd663702222cc182ae2ccac5e76870 (diff)
Execute the timers before pollset initialisation.
Since executing the timers might modify the source pollsets we have to defer the initialisation until after the timers have executed. Signed-off-by: Christian Gudrian <christian.gudrian@fluidon.com>
-rw-r--r--AUTHORS1
-rw-r--r--src/select.cpp6
2 files changed, 4 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index 70d816a..ab05561 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -8,6 +8,7 @@ Bernd Prager <bernd@prager.ws>
Bernd Melchers <melchers@ZEDAT.FU-Berlin.DE>
Brian Buchanan <bwb@holo.org>
Chris Wong <chris@chriswongstudio.com>
+Christian Gudrian <christian.gudrian@fluidon.com>
Conrad D. Steenberg <conrad.steenberg@caltech.edu>
Dhammika Pathirana <dhammika@gmail.com>
Dhruva Krishnamurthy <dhruva@ymail.com>
diff --git a/src/select.cpp b/src/select.cpp
index ae2ffe2..3a7cd81 100644
--- a/src/select.cpp
+++ b/src/select.cpp
@@ -147,14 +147,14 @@ void zmq::select_t::loop ()
{
while (!stopping) {
+ // Execute any due timers.
+ uint64_t timeout = execute_timers ();
+
// Intialise the pollsets.
memcpy (&readfds, &source_set_in, sizeof source_set_in);
memcpy (&writefds, &source_set_out, sizeof source_set_out);
memcpy (&exceptfds, &source_set_err, sizeof source_set_err);
- // Execute any due timers.
- uint64_t timeout = execute_timers ();
-
// Wait for events.
struct timeval tv = {(long) (timeout / 1000),
(long) (timeout % 1000 * 1000)};