mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix a data race in NonBlockingThreadPool
This commit is contained in:
@@ -29,6 +29,7 @@ class ThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
thread_data_(num_threads),
|
thread_data_(num_threads),
|
||||||
all_coprimes_(num_threads),
|
all_coprimes_(num_threads),
|
||||||
waiters_(num_threads),
|
waiters_(num_threads),
|
||||||
|
global_steal_partition_(EncodePartition(0, num_threads_)),
|
||||||
blocked_(0),
|
blocked_(0),
|
||||||
spinning_(0),
|
spinning_(0),
|
||||||
done_(false),
|
done_(false),
|
||||||
@@ -56,7 +57,6 @@ class ThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
thread_data_[i].thread.reset(
|
thread_data_[i].thread.reset(
|
||||||
env_.CreateThread([this, i]() { WorkerLoop(i); }));
|
env_.CreateThread([this, i]() { WorkerLoop(i); }));
|
||||||
}
|
}
|
||||||
global_steal_partition_ = EncodePartition(0, num_threads_);
|
|
||||||
#ifndef EIGEN_THREAD_LOCAL
|
#ifndef EIGEN_THREAD_LOCAL
|
||||||
// Wait for workers to initialize per_thread_map_. Otherwise we might race
|
// Wait for workers to initialize per_thread_map_. Otherwise we might race
|
||||||
// with them in Schedule or CurrentThreadId.
|
// with them in Schedule or CurrentThreadId.
|
||||||
|
|||||||
Reference in New Issue
Block a user