changeset 76:0aef120d7e1c wasm

fix for older versions of boost
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 24 May 2017 12:42:08 +0200
parents f0dd03210372
children f5f54ed8d307
files Framework/Toolbox/OrthancAsynchronousWebService.cpp
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Toolbox/OrthancAsynchronousWebService.cpp	Wed May 24 12:35:07 2017 +0200
+++ b/Framework/Toolbox/OrthancAsynchronousWebService.cpp	Wed May 24 12:42:08 2017 +0200
@@ -109,7 +109,7 @@
     boost::mutex                   mutex_;
     State                          state_;
     Orthanc::WebServiceParameters  orthanc_;
-    std::vector<boost::thread>     threads_;
+    std::vector<boost::thread*>    threads_;
     Orthanc::SharedMessageQueue    queue_;
 
     static void Worker(PImpl* that)
@@ -125,7 +125,6 @@
           state = that->state_;
         }
 
-        printf("."); fflush(stdout);
         if (state == State_Stopped)
         {
           break;
@@ -200,7 +199,7 @@
       
       for (size_t i = 0; i < threads_.size(); i++)
       {
-        threads_[i] = boost::thread(Worker, this);
+        threads_[i] = new boost::thread(Worker, this);
       }
 
       state_ = State_Started;
@@ -221,10 +220,14 @@
       
       for (size_t i = 0; i < threads_.size(); i++)
       {
-        if (threads_[i].joinable())
+        assert(threads_[i] != NULL);
+
+        if (threads_[i]->joinable())
         {
-          threads_[i].join();
+          threads_[i]->join();
         }
+
+        delete threads_[i];
       }
     }
   };