]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2871] Use IOService::post
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 8 Apr 2013 12:14:46 +0000 (14:14 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Wed, 24 Apr 2013 15:40:02 +0000 (17:40 +0200)
Instead of abusing the timer with 0 timeout, which is rejected.

src/bin/resolver/bench/fake_resolution.cc

index 2fb6cf86c83eba6a2482fd7507ec4ac5285ff92d..baa7d24203a7e6c51ebbca5675c60ee996bb3662 100644 (file)
@@ -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();
     }