]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2202] Comment catching of exceptions
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Tue, 2 Oct 2012 08:53:10 +0000 (10:53 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Tue, 2 Oct 2012 08:53:10 +0000 (10:53 +0200)
src/lib/util/threads/thread.cc

index ba3bfc6fc87a624ee93b695a897fe422d4d90106..3382fe2b1eeb35cdca760193a6a6128a9ba74370 100644 (file)
@@ -144,7 +144,10 @@ Thread::wait() {
 
     // Was there an exception in the thread?
     scoped_ptr<UncaughtException> ex;
-    try { // Something in here could in theory throw.
+    // Something here could in theory throw. But we already terminated the thread, so
+    // we need to make sure we are in consistent state even in such situation (like
+    // releasing the mutex and impl_).
+    try {
         if (impl_->exception_) {
             ex.reset(new UncaughtException(__FILE__, __LINE__,
                                            impl_->exception_text_.c_str()));
@@ -152,6 +155,8 @@ Thread::wait() {
     } catch (...) {
         Impl::done(impl_);
         impl_ = NULL;
+        // We have eaten the UncaughtException by now, but there's another
+        // exception instead, so we have at least something.
         throw;
     }