Mercurial > hg > orthanc
comparison OrthancServer/LuaScripting.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 | 3fc310ceb6d4 |
children | a27b0e9a3fd9 |
comparison
equal
deleted
inserted
replaced
2737:8ed9893c9230 | 2738:3a55b77339ff |
---|---|
31 **/ | 31 **/ |
32 | 32 |
33 | 33 |
34 #pragma once | 34 #pragma once |
35 | 35 |
36 #include "IServerListener.h" | 36 #include "DicomInstanceToStore.h" |
37 | |
38 #include "ServerJobs/LuaJobManager.h" | 37 #include "ServerJobs/LuaJobManager.h" |
39 | 38 |
40 #include "../Core/MultiThreading/SharedMessageQueue.h" | 39 #include "../Core/MultiThreading/SharedMessageQueue.h" |
41 #include "../Core/Lua/LuaContext.h" | 40 #include "../Core/Lua/LuaContext.h" |
42 | 41 |
43 namespace Orthanc | 42 namespace Orthanc |
44 { | 43 { |
45 class ServerContext; | 44 class ServerContext; |
46 | 45 |
47 class LuaScripting : public IServerListener | 46 class LuaScripting : public boost::noncopyable |
48 { | 47 { |
49 private: | 48 private: |
50 enum State | 49 enum State |
51 { | 50 { |
52 State_Setup, | 51 State_Setup, |
86 boost::thread eventThread_; | 85 boost::thread eventThread_; |
87 SharedMessageQueue pendingEvents_; | 86 SharedMessageQueue pendingEvents_; |
88 | 87 |
89 static void EventThread(LuaScripting* that); | 88 static void EventThread(LuaScripting* that); |
90 | 89 |
90 void LoadGlobalConfiguration(); | |
91 | |
91 public: | 92 public: |
92 class Lock : public boost::noncopyable | 93 class Lock : public boost::noncopyable |
93 { | 94 { |
94 private: | 95 private: |
95 LuaScripting& that_; | 96 LuaScripting& that_; |
114 | 115 |
115 void Start(); | 116 void Start(); |
116 | 117 |
117 void Stop(); | 118 void Stop(); |
118 | 119 |
119 virtual void SignalStoredInstance(const std::string& publicId, | 120 void SignalStoredInstance(const std::string& publicId, |
120 DicomInstanceToStore& instance, | 121 DicomInstanceToStore& instance, |
121 const Json::Value& simplifiedTags); | 122 const Json::Value& simplifiedTags); |
122 | 123 |
123 virtual void SignalChange(const ServerIndexChange& change); | 124 void SignalChange(const ServerIndexChange& change); |
124 | 125 |
125 virtual bool FilterIncomingInstance(const DicomInstanceToStore& instance, | 126 bool FilterIncomingInstance(const DicomInstanceToStore& instance, |
126 const Json::Value& simplifiedTags); | 127 const Json::Value& simplifiedTags); |
127 | 128 |
128 void Execute(const std::string& command); | 129 void Execute(const std::string& command); |
129 | |
130 void LoadGlobalConfiguration(); | |
131 | 130 |
132 void SignalJobSubmitted(const std::string& jobId); | 131 void SignalJobSubmitted(const std::string& jobId); |
133 | 132 |
134 void SignalJobSuccess(const std::string& jobId); | 133 void SignalJobSuccess(const std::string& jobId); |
135 | 134 |