Mercurial > hg > orthanc
comparison OrthancServer/ServerContext.h @ 2738:3a55b77339ff
fix deadlock in Lua scripts
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 16 Jul 2018 11:19:30 +0200 |
parents | 8e0bc055d18c |
children | 925d8dc03a23 |
comparison
equal
deleted
inserted
replaced
2737:8ed9893c9230 | 2738:3a55b77339ff |
---|---|
61 * DICOM store. It implements the required locking mechanisms. | 61 * DICOM store. It implements the required locking mechanisms. |
62 **/ | 62 **/ |
63 class ServerContext : private JobsRegistry::IObserver | 63 class ServerContext : private JobsRegistry::IObserver |
64 { | 64 { |
65 private: | 65 private: |
66 class LuaServerListener : public IServerListener | |
67 { | |
68 private: | |
69 ServerContext& context_; | |
70 | |
71 public: | |
72 LuaServerListener(ServerContext& context) : | |
73 context_(context) | |
74 { | |
75 } | |
76 | |
77 virtual void SignalStoredInstance(const std::string& publicId, | |
78 DicomInstanceToStore& instance, | |
79 const Json::Value& simplifiedTags) | |
80 { | |
81 context_.mainLua_.SignalStoredInstance(publicId, instance, simplifiedTags); | |
82 } | |
83 | |
84 virtual void SignalChange(const ServerIndexChange& change) | |
85 { | |
86 context_.mainLua_.SignalChange(change); | |
87 } | |
88 | |
89 virtual bool FilterIncomingInstance(const DicomInstanceToStore& instance, | |
90 const Json::Value& simplified) | |
91 { | |
92 return context_.filterLua_.FilterIncomingInstance(instance, simplified); | |
93 } | |
94 }; | |
95 | |
66 class DicomCacheProvider : public ICachePageProvider | 96 class DicomCacheProvider : public ICachePageProvider |
67 { | 97 { |
68 private: | 98 private: |
69 ServerContext& context_; | 99 ServerContext& context_; |
70 | 100 |
133 DicomCacheProvider provider_; | 163 DicomCacheProvider provider_; |
134 boost::mutex dicomCacheMutex_; | 164 boost::mutex dicomCacheMutex_; |
135 MemoryCache dicomCache_; | 165 MemoryCache dicomCache_; |
136 JobsEngine jobsEngine_; | 166 JobsEngine jobsEngine_; |
137 | 167 |
138 LuaScripting lua_; | 168 LuaScripting mainLua_; |
169 LuaScripting filterLua_; | |
170 LuaServerListener luaListener_; | |
139 | 171 |
140 #if ORTHANC_ENABLE_PLUGINS == 1 | 172 #if ORTHANC_ENABLE_PLUGINS == 1 |
141 OrthancPlugins* plugins_; | 173 OrthancPlugins* plugins_; |
142 #endif | 174 #endif |
143 | 175 |
277 return defaultLocalAet_; | 309 return defaultLocalAet_; |
278 } | 310 } |
279 | 311 |
280 LuaScripting& GetLuaScripting() | 312 LuaScripting& GetLuaScripting() |
281 { | 313 { |
282 return lua_; | 314 return mainLua_; |
283 } | 315 } |
284 | 316 |
285 OrthancHttpHandler& GetHttpHandler() | 317 OrthancHttpHandler& GetHttpHandler() |
286 { | 318 { |
287 return httpHandler_; | 319 return httpHandler_; |