diff OrthancServer/OrthancRestApi/OrthancRestSystem.cpp @ 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 83622b0f544c
children 01414536c930
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp	Thu Jul 03 15:58:53 2014 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestSystem.cpp	Thu Jul 03 16:27:16 2014 +0200
@@ -90,7 +90,12 @@
   {
     std::string result;
     ServerContext& context = OrthancRestApi::GetContext(call);
-    context.GetLuaContext().Execute(result, call.GetPostBody());
+
+    {
+      ServerContext::LuaContextLocker locker(context);
+      locker.GetLua().Execute(result, call.GetPostBody());
+    }
+
     call.GetOutput().AnswerBuffer(result, "text/plain");
   }