From e3e4ab20f6b07ac2c4b73d56228a0e8abeca5023 Mon Sep 17 00:00:00 2001 From: James Sedgwick Date: Fri, 19 Sep 2014 03:19:17 -0700 Subject: [PATCH] fix occasional crash in cpu pool Summary: need to initialize threadsToStop_ and make it signed so it doesn't underflow in rare races Test Plan: cpu pool unit tests no longer crash if run a ton of times Reviewed By: davejwatson@fb.com Subscribers: fugalh, njormrod FB internal diff: D1563524 --- folly/experimental/wangle/concurrent/CPUThreadPoolExecutor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/experimental/wangle/concurrent/CPUThreadPoolExecutor.h b/folly/experimental/wangle/concurrent/CPUThreadPoolExecutor.h index 210fd673..575e23c6 100644 --- a/folly/experimental/wangle/concurrent/CPUThreadPoolExecutor.h +++ b/folly/experimental/wangle/concurrent/CPUThreadPoolExecutor.h @@ -53,8 +53,8 @@ class CPUThreadPoolExecutor : public ThreadPoolExecutor { void threadRun(ThreadPtr thread) override; void stopThreads(size_t n) override; - std::atomic threadsToStop_; std::unique_ptr> taskQueue_; + std::atomic threadsToStop_{0}; }; }} // folly::wangle -- 2.34.1