Index: src/DefaultTimer.cpp |
=================================================================== |
--- a/src/DefaultTimer.cpp |
+++ b/src/DefaultTimer.cpp |
@@ -58,17 +58,18 @@ |
{ |
conditionVariable.wait(lock, [this]()->bool |
{ |
return shouldThreadStop || !timers.empty(); |
}); |
} |
else |
{ |
- conditionVariable.wait_until(lock, timers.top().fireAt); |
+ auto fireAt = timers.top().fireAt; |
+ conditionVariable.wait_until(lock, fireAt); |
} |
// execute all expired timers and remove them |
while (!shouldThreadStop && !timers.empty() && timers.top().fireAt <= std::chrono::steady_clock::now()) |
{ |
auto callback = timers.top().callback; |
timers.pop(); |
// allow to put new timers while this timer is being processed |
lock.unlock(); |