From fa4bb79fa3e972efc0e59abfda89b3e57b472dfa Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Tue, 5 Jul 2022 17:05:13 +0200 Subject: TaskSystem: Implement shutdown --- src/buildtool/multithreading/task_system.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/buildtool/multithreading/task_system.hpp') 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 threads_{}; std::vector queues_{}; std::atomic index_{0}; + std::atomic shutdown_{}; WaitableZeroCounter total_workload_{}; static constexpr std::size_t kNumberOfAttempts = 5; -- cgit v1.2.3