From 668690978ff66151b2a495767c7daf33d06be4a5 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Thu, 23 Aug 2018 12:54:33 -0700 Subject: Pad PerThread when we emulate thread_local to prevent false sharing. --- unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'unsupported/Eigen/CXX11/src/ThreadPool') diff --git a/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h b/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h index d710faa94..1cb63bcfa 100644 --- a/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h +++ b/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h @@ -153,6 +153,10 @@ class ThreadPoolTempl : public Eigen::ThreadPoolInterface { ThreadPoolTempl* pool; // Parent pool, or null for normal threads. uint64_t rand; // Random generator state. int thread_id; // Worker thread index in pool. +#ifndef EIGEN_THREAD_LOCAL + // Prevent false sharing. + char pad_[128]; +#endif }; Environment env_; -- cgit v1.2.3