summaryrefslogtreecommitdiff
path: root/src/buildtool/multithreading/task_system.hpp
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-07-05 17:05:13 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-07-07 12:55:13 +0200
commitfa4bb79fa3e972efc0e59abfda89b3e57b472dfa (patch)
tree973b0551911bd523020ef623f283271959dd0123 /src/buildtool/multithreading/task_system.hpp
parent1af5a281460901281104532c9bb398adcf269eb9 (diff)
downloadjustbuild-fa4bb79fa3e972efc0e59abfda89b3e57b472dfa.tar.gz
TaskSystem: Implement shutdown
Diffstat (limited to 'src/buildtool/multithreading/task_system.hpp')
-rw-r--r--src/buildtool/multithreading/task_system.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/buildtool/multithreading/task_system.hpp b/src/buildtool/multithreading/task_system.hpp
index 888ba090..5dbd92a6 100644
--- a/src/buildtool/multithreading/task_system.hpp
+++ b/src/buildtool/multithreading/task_system.hpp
@@ -48,6 +48,9 @@ class TaskSystem {
return thread_count_;
}
+ // Initiate shutdown, skip execution of pending tasks
+ void Shutdown() noexcept;
+
// Wait for all queues to become empty _and_ all tasks to finish.
void Finish() noexcept;
@@ -57,6 +60,7 @@ class TaskSystem {
std::vector<std::thread> threads_{};
std::vector<NotificationQueue> queues_{};
std::atomic<std::size_t> index_{0};
+ std::atomic<bool> shutdown_{};
WaitableZeroCounter total_workload_{};
static constexpr std::size_t kNumberOfAttempts = 5;