diff 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
line wrap: on
line diff
--- a/OrthancServer/LuaScripting.h	Thu Jul 02 15:17:19 2015 +0200
+++ b/OrthancServer/LuaScripting.h	Thu Jul 02 15:44:24 2015 +0200
@@ -67,7 +67,7 @@
 
     void OnStableResource(const ServerIndexChange& change);
 
-    boost::mutex    mutex_;
+    boost::recursive_mutex    mutex_;
     LuaContext      lua_;
     ServerContext&  context_;
 
@@ -76,16 +76,13 @@
     {
     private:
       LuaScripting& that_;
+      boost::recursive_mutex::scoped_lock lock_;
 
     public:
-      Locker(LuaScripting& that) : that_(that)
+      Locker(LuaScripting& that) : 
+        that_(that), 
+        lock_(that.mutex_)
       {
-        that.mutex_.lock();
-      }
-
-      ~Locker()
-      {
-        that_.mutex_.unlock();
       }
 
       LuaContext& GetLua()