changeset 431:16b52fb8d034

fix by cyril paulus
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 11 May 2013 12:19:20 +0200
parents f746592d8301
children 2b09d4ee86c6
files Core/MultiThreading/BagOfRunnablesBySteps.cpp OrthancServer/DicomProtocol/DicomServer.cpp OrthancServer/ServerIndex.cpp
diffstat 3 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Core/MultiThreading/BagOfRunnablesBySteps.cpp	Wed May 08 15:16:13 2013 +0200
+++ b/Core/MultiThreading/BagOfRunnablesBySteps.cpp	Sat May 11 12:19:20 2013 +0200
@@ -102,7 +102,11 @@
         assert(t.get() != NULL);
         assert(bag->pimpl_->activeThreads_.find(r.get()) == bag->pimpl_->activeThreads_.end());
 
-        t->join();
+        if (t->joinable())
+        {
+          t->join();
+        }
+
         bag->pimpl_->oneThreadIsJoined_.notify_one();
       }
 
@@ -128,7 +132,11 @@
     // Stop the finish listener
     pimpl_->stopFinishListener_ = true;
     pimpl_->oneThreadIsStopped_.notify_one();  // Awakens the listener
-    pimpl_->finishListener_->join();
+
+    if (pimpl_->finishListener_->joinable())
+    {
+      pimpl_->finishListener_->join();
+    }
   }
 
 
--- a/OrthancServer/DicomProtocol/DicomServer.cpp	Wed May 08 15:16:13 2013 +0200
+++ b/OrthancServer/DicomProtocol/DicomServer.cpp	Sat May 11 12:19:20 2013 +0200
@@ -385,7 +385,11 @@
   void DicomServer::Stop()
   {
     continue_ = false;
-    pimpl_->thread_.join();
+
+    if (pimpl_->thread_.joinable())
+    {
+      pimpl_->thread_.join();
+    }
 
     bagOfDispatchers_.StopAll();
   }
--- a/OrthancServer/ServerIndex.cpp	Wed May 08 15:16:13 2013 +0200
+++ b/OrthancServer/ServerIndex.cpp	Sat May 11 12:19:20 2013 +0200
@@ -291,8 +291,6 @@
   ServerIndex::~ServerIndex()
   {
     LOG(INFO) << "Stopping the database flushing thread";
-    /*flushThread_.terminate();
-      flushThread_.join();*/
   }