1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

ThreadPool: Improve exception handling

In particular, process() won't return as long as there are active
items. This prevents work item lambdas from referring to stack frames
that no longer exist.
This commit is contained in:
Eelco Dolstra 2017-09-08 14:40:27 +02:00
parent a2740c9ca2
commit 8f6b347abd
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 53 additions and 24 deletions

View file

@ -44,7 +44,7 @@ private:
struct State
{
std::queue<work_t> left;
size_t pending = 0;
size_t active = 0;
std::exception_ptr exception;
std::vector<std::thread> workers;
bool quit = false;