aboutsummaryrefslogtreecommitdiff
path: root/src/scheduler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/scheduler.h')
-rw-r--r--src/scheduler.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/scheduler.h b/src/scheduler.h
index 7ebe3df37f..63f20f1335 100644
--- a/src/scheduler.h
+++ b/src/scheduler.h
@@ -65,10 +65,18 @@ public:
// and interrupted using boost::interrupt_thread
void serviceQueue();
- // Tell any threads running serviceQueue to stop as soon as they're
- // done servicing whatever task they're currently servicing (drain=false)
- // or when there is no work left to be done (drain=true)
- void stop(bool drain=false);
+ /** Tell any threads running serviceQueue to stop as soon as the current task is done */
+ void stop()
+ {
+ WITH_LOCK(newTaskMutex, stopRequested = true);
+ newTaskScheduled.notify_all();
+ }
+ /** Tell any threads running serviceQueue to stop when there is no work left to be done */
+ void StopWhenDrained()
+ {
+ WITH_LOCK(newTaskMutex, stopWhenEmpty = true);
+ newTaskScheduled.notify_all();
+ }
// Returns number of tasks waiting to be serviced,
// and first and last task times