Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/DefaultTimer.cpp

Issue 29404607: Issue 5116 - Copy the timer delay before waiting for it. (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 6, 2017, 2:02 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld