diff OrthancServer/ServerContext.cpp @ 1447:5ba7471780ae

refactoring: HttpToolbox, DumpJson in Lua
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Jul 2015 17:42:06 +0200
parents 0a3e3be59094
children c0bdc47165ef
line wrap: on
line diff
--- a/OrthancServer/ServerContext.cpp	Wed Jul 01 13:16:12 2015 +0200
+++ b/OrthancServer/ServerContext.cpp	Wed Jul 01 17:42:06 2015 +0200
@@ -71,7 +71,7 @@
   {
     while (!that->done_)
     {
-      std::auto_ptr<IDynamicObject> obj(that->pendingChanges_.Dequeue(500));
+      std::auto_ptr<IDynamicObject> obj(that->pendingChanges_.Dequeue(100));
         
       if (obj.get() != NULL)
       {
@@ -119,11 +119,20 @@
   
   ServerContext::~ServerContext()
   {
-    done_ = true;
+    Stop();
+  }
+
 
-    if (changeThread_.joinable())
+  void ServerContext::Stop()
+  {
+    if (!done_)
     {
-      changeThread_.join();
+      done_ = true;
+
+      if (changeThread_.joinable())
+      {
+        changeThread_.join();
+      }
     }
   }