From 0f8bfff23df9375080fb08de947c623f652fe27b Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Mon, 11 Mar 2019 09:38:44 -0700 Subject: [PATCH] Fix a data race in NonBlockingThreadPool --- unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h b/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h index bd1910dcc..9e54254c1 100644 --- a/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h +++ b/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h @@ -29,6 +29,7 @@ class ThreadPoolTempl : public Eigen::ThreadPoolInterface { thread_data_(num_threads), all_coprimes_(num_threads), waiters_(num_threads), + global_steal_partition_(EncodePartition(0, num_threads_)), blocked_(0), spinning_(0), done_(false), @@ -56,7 +57,6 @@ class ThreadPoolTempl : public Eigen::ThreadPoolInterface { thread_data_[i].thread.reset( env_.CreateThread([this, i]() { WorkerLoop(i); })); } - global_steal_partition_ = EncodePartition(0, num_threads_); #ifndef EIGEN_THREAD_LOCAL // Wait for workers to initialize per_thread_map_. Otherwise we might race // with them in Schedule or CurrentThreadId.