diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-07-05 17:05:13 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-07-07 12:55:13 +0200 |
commit | fa4bb79fa3e972efc0e59abfda89b3e57b472dfa (patch) | |
tree | 973b0551911bd523020ef623f283271959dd0123 /src/buildtool/multithreading/task_system.hpp | |
parent | 1af5a281460901281104532c9bb398adcf269eb9 (diff) | |
download | justbuild-fa4bb79fa3e972efc0e59abfda89b3e57b472dfa.tar.gz |
TaskSystem: Implement shutdown
Diffstat (limited to 'src/buildtool/multithreading/task_system.hpp')
-rw-r--r-- | src/buildtool/multithreading/task_system.hpp | 4 |
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; |