Mercurial > hg > orthanc
diff OrthancServer/LuaScripting.cpp @ 2651:1da5a052c777 jobs
testing value serialization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 04 Jun 2018 11:53:12 +0200 |
parents | 193ef9c1b731 |
children | 389d050a2e66 |
line wrap: on
line diff
--- a/OrthancServer/LuaScripting.cpp Fri Jun 01 19:03:28 2018 +0200 +++ b/OrthancServer/LuaScripting.cpp Mon Jun 04 11:53:12 2018 +0200 @@ -516,7 +516,7 @@ LuaScripting::LuaScripting(ServerContext& context) : context_(context), - continue_(true) + state_(State_Setup) { lua_.SetGlobalVariable("_ServerContext", &context); lua_.RegisterFunction("RestApiGet", RestApiGet); @@ -529,7 +529,7 @@ LuaScripting::~LuaScripting() { - if (continue_) + if (state_ == State_Running) { LOG(ERROR) << "INTERNAL ERROR: LuaScripting::Stop() should be invoked manually to avoid mess in the destruction order!"; Stop(); @@ -548,7 +548,7 @@ // The event queue is empty, check whether we should stop boost::recursive_mutex::scoped_lock lock(that->mutex_); - if (!that->continue_) + if (that->state_ != State_Running) { return; } @@ -572,7 +572,7 @@ { boost::recursive_mutex::scoped_lock lock(mutex_); - if (!continue_ || + if (state_ != State_Setup || eventThread_.joinable() /* already started */) { throw OrthancException(ErrorCode_BadSequenceOfCalls); @@ -590,12 +590,12 @@ { boost::recursive_mutex::scoped_lock lock(mutex_); - if (!continue_) + if (state_ != State_Running) { throw OrthancException(ErrorCode_BadSequenceOfCalls); } - continue_ = false; + state_ = State_Done; } jobManager_.AwakeTrailingSleep();