Mercurial > hg > orthanc
diff OrthancServer/ServerContext.h @ 996:cf52f3bcb2b3 lua-scripting
clarification of Lua classes wrt multithreading
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 03 Jul 2014 16:27:16 +0200 |
parents | 394a19d44f9d |
children | 4136fab6a639 |
line wrap: on
line diff
--- a/OrthancServer/ServerContext.h Thu Jul 03 15:58:53 2014 +0200 +++ b/OrthancServer/ServerContext.h Thu Jul 03 16:27:16 2014 +0200 @@ -65,6 +65,9 @@ virtual IDynamicObject* Provide(const std::string& id); }; + bool ApplyReceivedInstanceFilter(const Json::Value& dicomJson, + const std::string& remoteAet); + FileStorage storage_; ServerIndex index_; CompressedFileStorageAccessor accessor_; @@ -76,10 +79,11 @@ ReusableDicomUserConnection scu_; ServerScheduler scheduler_; + boost::mutex luaMutex_; LuaContext lua_; public: - class DicomCacheLocker + class DicomCacheLocker : public boost::noncopyable { private: ServerContext& that_; @@ -97,6 +101,28 @@ } }; + class LuaContextLocker : public boost::noncopyable + { + private: + ServerContext& that_; + + public: + LuaContextLocker(ServerContext& that) : that_(that) + { + that.luaMutex_.lock(); + } + + ~LuaContextLocker() + { + that_.luaMutex_.unlock(); + } + + LuaContext& GetLua() + { + return that_.lua_; + } + }; + ServerContext(const boost::filesystem::path& storagePath, const boost::filesystem::path& indexPath); @@ -153,11 +179,6 @@ FileContentType content, bool uncompressIfNeeded = true); - LuaContext& GetLuaContext() - { - return lua_; - } - void SetStoreMD5ForAttachments(bool storeMD5); bool IsStoreMD5ForAttachments() const