comparison OrthancServer/ServerContext.cpp @ 1459:040d58493998

security
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 02 Jul 2015 15:59:09 +0200
parents 68827c07e683
children f967bdf8534e
comparison
equal deleted inserted replaced
1458:1d109322f5d3 1459:040d58493998
130 130
131 void ServerContext::Stop() 131 void ServerContext::Stop()
132 { 132 {
133 if (!done_) 133 if (!done_)
134 { 134 {
135 {
136 boost::recursive_mutex::scoped_lock lock(listenersMutex_);
137 listeners_.clear();
138 }
139
135 done_ = true; 140 done_ = true;
136 141
137 if (changeThread_.joinable()) 142 if (changeThread_.joinable())
138 { 143 {
139 changeThread_.join(); 144 changeThread_.join();
434 } 439 }
435 440
436 441
437 void ServerContext::SetPlugins(OrthancPlugins& plugins) 442 void ServerContext::SetPlugins(OrthancPlugins& plugins)
438 { 443 {
444 boost::recursive_mutex::scoped_lock lock(listenersMutex_);
445
439 plugins_ = &plugins; 446 plugins_ = &plugins;
440 447
441 // TODO REFACTOR THIS 448 // TODO REFACTOR THIS
442 boost::recursive_mutex::scoped_lock lock(listenersMutex_);
443 listeners_.clear(); 449 listeners_.clear();
444 listeners_.push_back(ServerListener(lua_, "Lua")); 450 listeners_.push_back(ServerListener(lua_, "Lua"));
445 listeners_.push_back(ServerListener(plugins, "plugin")); 451 listeners_.push_back(ServerListener(plugins, "plugin"));
446 } 452 }
447 453
448 454
449 void ServerContext::ResetPlugins() 455 void ServerContext::ResetPlugins()
450 { 456 {
457 boost::recursive_mutex::scoped_lock lock(listenersMutex_);
458
451 plugins_ = NULL; 459 plugins_ = NULL;
452 460
453 // TODO REFACTOR THIS 461 // TODO REFACTOR THIS
454 boost::recursive_mutex::scoped_lock lock(listenersMutex_);
455 listeners_.clear(); 462 listeners_.clear();
456 listeners_.push_back(ServerListener(lua_, "Lua")); 463 listeners_.push_back(ServerListener(lua_, "Lua"));
457 } 464 }
458 465
459 466