Mercurial > hg > orthanc
changeset 5022:3d0a084e1ace
fix to non-static variable
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 17 Jun 2022 07:20:19 +0200 |
parents | 559b35d18ef7 |
children | c8c98389080f |
files | OrthancServer/Sources/LuaScripting.cpp |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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)