File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed
Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change 2222// ******************************************************************************************************
2323
2424#include " Timer.h"
25+ #include " ManualResetEvent.h"
2526
2627using namespace std ;
2728using namespace sttp ;
@@ -40,15 +41,8 @@ void Timer::TimerThread()
4041
4142 if (interval > 0 )
4243 {
43- static constexpr int32_t MaxSleepDuration = 500 ;
44- const int32_t waits = interval / MaxSleepDuration;
45- const int32_t remainder = interval % MaxSleepDuration;
46-
47- for (int32_t i = 0 ; i < waits && m_running; i++)
48- ThreadSleep (MaxSleepDuration);
49-
50- if (remainder > 0 && m_running)
51- ThreadSleep (remainder);
44+ ManualResetEvent handle;
45+ handle.Wait (interval);
5246 }
5347 }
5448 catch (boost::thread_interrupted&)
You can’t perform that action at this time.
0 commit comments