aboutsummaryrefslogtreecommitdiff
path: root/src/scheduler.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-05-21 18:57:10 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-05-21 19:07:10 +0200
commitbdcf5dea7c2e7493be7d8fc157e168b77cce7dcc (patch)
treed53175023a197c475a2c3d797367867bfde80791 /src/scheduler.cpp
parent0d862c2739b96005fdf0e2a4df347e7291956fc1 (diff)
Fix intermittent hang issue in scheduler_tests
Don't clear `stopRequested` and `stopWhenEmpty` at the top of `serviceQueue`, as this results in a race condition: on systems under heavy load, some of the threads only get scheduled on the CPU when the other threads have already finished their work. This causes the flags to be cleared post-hoc and thus those threads to wait forever. The potential drawback of this change is that the scheduler cannot be restarted after being stopped (an explicit reset would be needed), but we don't use this functionality anyway.
Diffstat (limited to 'src/scheduler.cpp')
-rw-r--r--src/scheduler.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/scheduler.cpp b/src/scheduler.cpp
index 4f1d8be7c0..c42eb7244d 100644
--- a/src/scheduler.cpp
+++ b/src/scheduler.cpp
@@ -29,8 +29,6 @@ void CScheduler::serviceQueue()
{
boost::unique_lock<boost::mutex> lock(newTaskMutex);
++nThreadsServicingQueue;
- stopRequested = false;
- stopWhenEmpty = false;
// newTaskMutex is locked throughout this loop EXCEPT
// when the thread is waiting or when the user's function