comparison OrthancServer/LuaScripting.h @ 1456:68827c07e683

fix recursive calls with Lua
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 02 Jul 2015 15:44:24 +0200
parents a68545767975
children 904096e7367e
comparison
equal deleted inserted replaced
1455:a68545767975 1456:68827c07e683
65 65
66 void SubmitJob(const std::string& description); 66 void SubmitJob(const std::string& description);
67 67
68 void OnStableResource(const ServerIndexChange& change); 68 void OnStableResource(const ServerIndexChange& change);
69 69
70 boost::mutex mutex_; 70 boost::recursive_mutex mutex_;
71 LuaContext lua_; 71 LuaContext lua_;
72 ServerContext& context_; 72 ServerContext& context_;
73 73
74 public: 74 public:
75 class Locker : public boost::noncopyable 75 class Locker : public boost::noncopyable
76 { 76 {
77 private: 77 private:
78 LuaScripting& that_; 78 LuaScripting& that_;
79 boost::recursive_mutex::scoped_lock lock_;
79 80
80 public: 81 public:
81 Locker(LuaScripting& that) : that_(that) 82 Locker(LuaScripting& that) :
83 that_(that),
84 lock_(that.mutex_)
82 { 85 {
83 that.mutex_.lock();
84 }
85
86 ~Locker()
87 {
88 that_.mutex_.unlock();
89 } 86 }
90 87
91 LuaContext& GetLua() 88 LuaContext& GetLua()
92 { 89 {
93 return that_.lua_; 90 return that_.lua_;