comparison OrthancServer/Scheduler/ServerScheduler.cpp @ 1453:c0bdc47165ef

code to warn about possible threading problems
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 02 Jul 2015 12:26:44 +0200
parents 7b6925b0890d
children f967bdf8534e
comparison
equal deleted inserted replaced
1452:b737acb13da5 1453:c0bdc47165ef
197 } 197 }
198 198
199 199
200 ServerScheduler::~ServerScheduler() 200 ServerScheduler::~ServerScheduler()
201 { 201 {
202 finish_ = true; 202 if (!finish_)
203 worker_.join(); 203 {
204 LOG(ERROR) << "INTERNAL ERROR: ServerScheduler::Finalize() should be invoked manually to avoid mess in the destruction order!";
205 Stop();
206 }
207 }
208
209
210 void ServerScheduler::Stop()
211 {
212 if (!finish_)
213 {
214 finish_ = true;
215
216 if (worker_.joinable())
217 {
218 worker_.join();
219 }
220 }
204 } 221 }
205 222
206 223
207 void ServerScheduler::Submit(ServerJob& job) 224 void ServerScheduler::Submit(ServerJob& job)
208 { 225 {