Commit e3e4ab20 authored by James Sedgwick's avatar James Sedgwick Committed by dcsommer

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
parent ea6c8014
......@@ -53,8 +53,8 @@ class CPUThreadPoolExecutor : public ThreadPoolExecutor {
void threadRun(ThreadPtr thread) override;
void stopThreads(size_t n) override;
std::atomic<size_t> threadsToStop_;
std::unique_ptr<BlockingQueue<Task>> taskQueue_;
std::atomic<ssize_t> threadsToStop_{0};
};
}} // folly::wangle
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment