comparison Framework/Toolbox/OrthancAsynchronousWebService.cpp @ 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 f73aed014bde
children f5f54ed8d307
comparison
equal deleted inserted replaced
75:f0dd03210372 76:0aef120d7e1c
107 }; 107 };
108 108
109 boost::mutex mutex_; 109 boost::mutex mutex_;
110 State state_; 110 State state_;
111 Orthanc::WebServiceParameters orthanc_; 111 Orthanc::WebServiceParameters orthanc_;
112 std::vector<boost::thread> threads_; 112 std::vector<boost::thread*> threads_;
113 Orthanc::SharedMessageQueue queue_; 113 Orthanc::SharedMessageQueue queue_;
114 114
115 static void Worker(PImpl* that) 115 static void Worker(PImpl* that)
116 { 116 {
117 OrthancPlugins::OrthancHttpConnection connection(that->orthanc_); 117 OrthancPlugins::OrthancHttpConnection connection(that->orthanc_);
123 { 123 {
124 boost::mutex::scoped_lock lock(that->mutex_); 124 boost::mutex::scoped_lock lock(that->mutex_);
125 state = that->state_; 125 state = that->state_;
126 } 126 }
127 127
128 printf("."); fflush(stdout);
129 if (state == State_Stopped) 128 if (state == State_Stopped)
130 { 129 {
131 break; 130 break;
132 } 131 }
133 132
198 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls); 197 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
199 } 198 }
200 199
201 for (size_t i = 0; i < threads_.size(); i++) 200 for (size_t i = 0; i < threads_.size(); i++)
202 { 201 {
203 threads_[i] = boost::thread(Worker, this); 202 threads_[i] = new boost::thread(Worker, this);
204 } 203 }
205 204
206 state_ = State_Started; 205 state_ = State_Started;
207 } 206 }
208 207
219 state_ = State_Stopped; 218 state_ = State_Stopped;
220 } 219 }
221 220
222 for (size_t i = 0; i < threads_.size(); i++) 221 for (size_t i = 0; i < threads_.size(); i++)
223 { 222 {
224 if (threads_[i].joinable()) 223 assert(threads_[i] != NULL);
225 { 224
226 threads_[i].join(); 225 if (threads_[i]->joinable())
227 } 226 {
227 threads_[i]->join();
228 }
229
230 delete threads_[i];
228 } 231 }
229 } 232 }
230 }; 233 };
231 234
232 OrthancAsynchronousWebService::OrthancAsynchronousWebService( 235 OrthancAsynchronousWebService::OrthancAsynchronousWebService(