# HG changeset patch # User Sebastien Jodogne # Date 1655443219 -7200 # Node ID 3d0a084e1ace6f1e18b1e9ec98c086c735196f81 # Parent 559b35d18ef79e4b9af63ba5a0540761d39bc767 fix to non-static variable diff -r 559b35d18ef7 -r 3d0a084e1ace OrthancServer/Sources/LuaScripting.cpp --- a/OrthancServer/Sources/LuaScripting.cpp Wed Jun 15 15:40:07 2022 +0200 +++ b/OrthancServer/Sources/LuaScripting.cpp Fri Jun 17 07:20:19 2022 +0200 @@ -785,11 +785,11 @@ void LuaScripting::HeartBeatThread(LuaScripting* that) { - static const boost::posix_time::time_duration PERIODICITY = + static const unsigned int GRANULARITY = 100; // In milliseconds + + const boost::posix_time::time_duration PERIODICITY = boost::posix_time::seconds(that->heartBeatPeriod_); - unsigned int sleepDelay = 100; - boost::posix_time::ptime next = boost::posix_time::microsec_clock::universal_time() + PERIODICITY; @@ -797,7 +797,7 @@ while (!shouldStop) { - boost::this_thread::sleep(boost::posix_time::milliseconds(sleepDelay)); + boost::this_thread::sleep(boost::posix_time::milliseconds(GRANULARITY)); if (boost::posix_time::microsec_clock::universal_time() >= next) { @@ -812,10 +812,11 @@ next = boost::posix_time::microsec_clock::universal_time() + PERIODICITY; } - boost::recursive_mutex::scoped_lock lock(that->mutex_); - shouldStop = that->state_ == State_Done; + { + boost::recursive_mutex::scoped_lock lock(that->mutex_); + shouldStop = (that->state_ == State_Done); + } } - } void LuaScripting::EventThread(LuaScripting* that)