Browse Source

[2871] Use IOService::post

Instead of abusing the timer with 0 timeout, which is rejected.
Michal 'vorner' Vaner 12 years ago
parent
commit
e7f74b8e4b
1 changed files with 4 additions and 5 deletions
  1. 4 5
      src/bin/resolver/bench/fake_resolution.cc

+ 4 - 5
src/bin/resolver/bench/fake_resolution.cc

@@ -114,12 +114,11 @@ FakeQueryPtr
 FakeInterface::receiveQuery() {
     // Handle all the events that are already scheduled.
     // As processEvents blocks until an event happens and we want to terminate
-    // if there are no events, we do a small trick. We schedule a timeout with
-    // 0 time. That'll place the event for it directly at the end of the queue.
-    // Then, we'll just call processEvents() until that event happens.
+    // if there are no events, we do a small trick. We post an event to the end
+    // of the queue and work until it is found. This should process all the
+    // events that were there already.
     bool processed = false;
-    asiolink::IntervalTimer zero_timer(service_);
-    zero_timer.setup(boost::bind(&processDone, &processed), 0);
+    service_.post(boost::bind(&processDone, &processed));
     while (!processed) {
         processEvents();
     }