comparison Core/JobsEngine/JobsEngine.cpp @ 2591:441f23af9d89 jobs

fix for older releases of boost::thread
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 May 2018 11:26:08 +0200
parents 8da2cffc2378
children 34dc57f4a7d2
comparison
equal deleted inserted replaced
2590:5e2730c8e23c 2591:441f23af9d89
224 workers_.resize(n); 224 workers_.resize(n);
225 } 225 }
226 226
227 for (size_t i = 0; i < workers_.size(); i++) 227 for (size_t i = 0; i < workers_.size(); i++)
228 { 228 {
229 workers_[i] = boost::thread(Worker, this, i); 229 assert(workers_[i] == NULL);
230 workers_[i] = new boost::thread(Worker, this, i);
230 } 231 }
231 232
232 state_ = State_Running; 233 state_ = State_Running;
233 234
234 LOG(WARNING) << "The jobs engine has started with " << workers_.size() << " threads"; 235 LOG(WARNING) << "The jobs engine has started with " << workers_.size() << " threads";
255 retryHandler_.join(); 256 retryHandler_.join();
256 } 257 }
257 258
258 for (size_t i = 0; i < workers_.size(); i++) 259 for (size_t i = 0; i < workers_.size(); i++)
259 { 260 {
260 if (workers_[i].joinable()) 261 assert(workers_[i] != NULL);
261 { 262
262 workers_[i].join(); 263 if (workers_[i]->joinable())
263 } 264 {
265 workers_[i]->join();
266 }
267
268 delete workers_[i];
264 } 269 }
265 270
266 { 271 {
267 boost::mutex::scoped_lock lock(stateMutex_); 272 boost::mutex::scoped_lock lock(stateMutex_);
268 state_ = State_Done; 273 state_ = State_Done;