comparison OrthancServer/ServerContext.cpp @ 1456:68827c07e683

fix recursive calls with Lua
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 02 Jul 2015 15:44:24 +0200
parents c0bdc47165ef
children 040d58493998
comparison
equal deleted inserted replaced
1455:a68545767975 1456:68827c07e683
75 75
76 if (obj.get() != NULL) 76 if (obj.get() != NULL)
77 { 77 {
78 const ServerIndexChange& change = dynamic_cast<const ServerIndexChange&>(*obj.get()); 78 const ServerIndexChange& change = dynamic_cast<const ServerIndexChange&>(*obj.get());
79 79
80 boost::mutex::scoped_lock lock(that->listenersMutex_); 80 boost::recursive_mutex::scoped_lock lock(that->listenersMutex_);
81 for (ServerListeners::iterator it = that->listeners_.begin(); 81 for (ServerListeners::iterator it = that->listeners_.begin();
82 it != that->listeners_.end(); ++it) 82 it != that->listeners_.end(); ++it)
83 { 83 {
84 try 84 try
85 { 85 {
178 178
179 // Test if the instance must be filtered out 179 // Test if the instance must be filtered out
180 bool accepted = true; 180 bool accepted = true;
181 181
182 { 182 {
183 boost::mutex::scoped_lock lock(listenersMutex_); 183 boost::recursive_mutex::scoped_lock lock(listenersMutex_);
184 184
185 for (ServerListeners::iterator it = listeners_.begin(); it != listeners_.end(); ++it) 185 for (ServerListeners::iterator it = listeners_.begin(); it != listeners_.end(); ++it)
186 { 186 {
187 try 187 try
188 { 188 {
264 } 264 }
265 265
266 if (status == StoreStatus_Success || 266 if (status == StoreStatus_Success ||
267 status == StoreStatus_AlreadyStored) 267 status == StoreStatus_AlreadyStored)
268 { 268 {
269 boost::mutex::scoped_lock lock(listenersMutex_); 269 boost::recursive_mutex::scoped_lock lock(listenersMutex_);
270 270
271 for (ServerListeners::iterator it = listeners_.begin(); it != listeners_.end(); ++it) 271 for (ServerListeners::iterator it = listeners_.begin(); it != listeners_.end(); ++it)
272 { 272 {
273 try 273 try
274 { 274 {
437 void ServerContext::SetPlugins(OrthancPlugins& plugins) 437 void ServerContext::SetPlugins(OrthancPlugins& plugins)
438 { 438 {
439 plugins_ = &plugins; 439 plugins_ = &plugins;
440 440
441 // TODO REFACTOR THIS 441 // TODO REFACTOR THIS
442 boost::mutex::scoped_lock lock(listenersMutex_); 442 boost::recursive_mutex::scoped_lock lock(listenersMutex_);
443 listeners_.clear(); 443 listeners_.clear();
444 listeners_.push_back(ServerListener(lua_, "Lua")); 444 listeners_.push_back(ServerListener(lua_, "Lua"));
445 listeners_.push_back(ServerListener(plugins, "plugin")); 445 listeners_.push_back(ServerListener(plugins, "plugin"));
446 } 446 }
447 447
449 void ServerContext::ResetPlugins() 449 void ServerContext::ResetPlugins()
450 { 450 {
451 plugins_ = NULL; 451 plugins_ = NULL;
452 452
453 // TODO REFACTOR THIS 453 // TODO REFACTOR THIS
454 boost::mutex::scoped_lock lock(listenersMutex_); 454 boost::recursive_mutex::scoped_lock lock(listenersMutex_);
455 listeners_.clear(); 455 listeners_.clear();
456 listeners_.push_back(ServerListener(lua_, "Lua")); 456 listeners_.push_back(ServerListener(lua_, "Lua"));
457 } 457 }
458 458
459 459