From 8f6b347abd93706e36cf67fc4c53a46c7ad1ad49 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 8 Sep 2017 14:40:27 +0200 Subject: 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. --- src/libutil/thread-pool.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libutil/thread-pool.hh') diff --git a/src/libutil/thread-pool.hh b/src/libutil/thread-pool.hh index 361a9d33a732..835dfb4b83a6 100644 --- a/src/libutil/thread-pool.hh +++ b/src/libutil/thread-pool.hh @@ -44,7 +44,7 @@ private: struct State { std::queue left; - size_t pending = 0; + size_t active = 0; std::exception_ptr exception; std::vector workers; bool quit = false; -- cgit 1.4.1