mirror of
https://github.com/NixOS/nix
synced 2025-06-27 12:41:15 +02:00
ThreadPool: On exception, interrupt the other worker threads
This commit is contained in:
parent
6a888ec29a
commit
b7376edf06
4 changed files with 14 additions and 7 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <functional>
|
||||
#include <thread>
|
||||
#include <map>
|
||||
#include <atomic>
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
@ -47,9 +48,10 @@ private:
|
|||
size_t active = 0;
|
||||
std::exception_ptr exception;
|
||||
std::vector<std::thread> workers;
|
||||
bool quit = false;
|
||||
};
|
||||
|
||||
std::atomic_bool quit{false};
|
||||
|
||||
Sync<State> state_;
|
||||
|
||||
std::condition_variable work, done;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue