Mercurial > hg > orthanc
comparison OrthancServer/Sources/LuaScripting.cpp @ 5022:3d0a084e1ace
fix to non-static variable
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 17 Jun 2022 07:20:19 +0200 |
parents | eb8ca3403983 |
children | c8c98389080f |
comparison
equal
deleted
inserted
replaced
5021:559b35d18ef7 | 5022:3d0a084e1ace |
---|---|
783 } | 783 } |
784 } | 784 } |
785 | 785 |
786 void LuaScripting::HeartBeatThread(LuaScripting* that) | 786 void LuaScripting::HeartBeatThread(LuaScripting* that) |
787 { | 787 { |
788 static const boost::posix_time::time_duration PERIODICITY = | 788 static const unsigned int GRANULARITY = 100; // In milliseconds |
789 | |
790 const boost::posix_time::time_duration PERIODICITY = | |
789 boost::posix_time::seconds(that->heartBeatPeriod_); | 791 boost::posix_time::seconds(that->heartBeatPeriod_); |
790 | |
791 unsigned int sleepDelay = 100; | |
792 | 792 |
793 boost::posix_time::ptime next = | 793 boost::posix_time::ptime next = |
794 boost::posix_time::microsec_clock::universal_time() + PERIODICITY; | 794 boost::posix_time::microsec_clock::universal_time() + PERIODICITY; |
795 | 795 |
796 bool shouldStop = false; | 796 bool shouldStop = false; |
797 | 797 |
798 while (!shouldStop) | 798 while (!shouldStop) |
799 { | 799 { |
800 boost::this_thread::sleep(boost::posix_time::milliseconds(sleepDelay)); | 800 boost::this_thread::sleep(boost::posix_time::milliseconds(GRANULARITY)); |
801 | 801 |
802 if (boost::posix_time::microsec_clock::universal_time() >= next) | 802 if (boost::posix_time::microsec_clock::universal_time() >= next) |
803 { | 803 { |
804 LuaScripting::Lock lock(*that); | 804 LuaScripting::Lock lock(*that); |
805 | 805 |
810 } | 810 } |
811 | 811 |
812 next = boost::posix_time::microsec_clock::universal_time() + PERIODICITY; | 812 next = boost::posix_time::microsec_clock::universal_time() + PERIODICITY; |
813 } | 813 } |
814 | 814 |
815 boost::recursive_mutex::scoped_lock lock(that->mutex_); | 815 { |
816 shouldStop = that->state_ == State_Done; | 816 boost::recursive_mutex::scoped_lock lock(that->mutex_); |
817 } | 817 shouldStop = (that->state_ == State_Done); |
818 | 818 } |
819 } | |
819 } | 820 } |
820 | 821 |
821 void LuaScripting::EventThread(LuaScripting* that) | 822 void LuaScripting::EventThread(LuaScripting* that) |
822 { | 823 { |
823 for (;;) | 824 for (;;) |