[svn] commit: r3352 - /branches/vorner-recursor-config/src/lib/asiolink/asiolink.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Oct 26 07:58:11 UTC 2010


Author: vorner
Date: Tue Oct 26 07:58:11 2010
New Revision: 3352

Log:
More fixes of stopped asio::io_service

It stops itself when there's no more work and tells nobody about it. So
we need detect it was stopped (there seem to be no other way than trying
and looking at how many events it processed), reset and try again.

Modified:
    branches/vorner-recursor-config/src/lib/asiolink/asiolink.cc

Modified: branches/vorner-recursor-config/src/lib/asiolink/asiolink.cc
==============================================================================
--- branches/vorner-recursor-config/src/lib/asiolink/asiolink.cc (original)
+++ branches/vorner-recursor-config/src/lib/asiolink/asiolink.cc Tue Oct 26 07:58:11 2010
@@ -187,12 +187,21 @@
 
 void
 IOService::run() {
-    impl_->io_service_.run();
+    if (!impl_->io_service_.run()) {
+        // We got the io_service in stopped state and it didn't work
+        // Reset it and try again
+        impl_->io_service_.reset();
+        impl_->io_service_.run();
+    }
 }
 
 void
 IOService::run_one() {
-    impl_->io_service_.run_one();
+    if (!impl_->io_service_.run_one()) {
+        // Same as in run() - we got it in stopped state
+        impl_->io_service_.reset();
+        impl_->io_service_.run_one();
+    }
 }
 
 void




More information about the bind10-changes mailing list