From 6a31b7be3ea29a5300ff575f0bada876b70904d6 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Tue, 22 Mar 2016 14:02:50 -0700 Subject: Avoid using std::vector whenever possible --- unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h index dcbef5b03..b282f5c07 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h @@ -27,7 +27,7 @@ class ThreadPoolInterface { class ThreadPool : public ThreadPoolInterface { public: // Construct a pool that contains "num_threads" threads. - explicit ThreadPool(int num_threads) { + explicit ThreadPool(int num_threads) : threads_(num_threads), waiting_(num_threads) { for (int i = 0; i < num_threads; i++) { threads_.push_back(new std::thread([this]() { WorkerLoop(); })); } @@ -110,8 +110,8 @@ class ThreadPool : public ThreadPoolInterface { }; std::mutex mu_; - std::vector threads_; // All threads - std::vector waiters_; // Stack of waiting threads. + MaxSizeVector threads_; // All threads + MaxSizeVector waiters_; // Stack of waiting threads. std::deque> pending_; // Queue of pending work std::condition_variable empty_; // Signaled on pending_.empty() bool exiting_ = false; -- cgit v1.2.3 From bc2b8027514b27b3c67800d5c951e5d532f76f02 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Tue, 22 Mar 2016 14:27:34 -0700 Subject: Fixed a couple of typos --- unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h index b282f5c07..4d803c95b 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h @@ -27,7 +27,7 @@ class ThreadPoolInterface { class ThreadPool : public ThreadPoolInterface { public: // Construct a pool that contains "num_threads" threads. - explicit ThreadPool(int num_threads) : threads_(num_threads), waiting_(num_threads) { + explicit ThreadPool(int num_threads) : threads_(num_threads, NULL), waiting_(num_threads, NULL) { for (int i = 0; i < num_threads; i++) { threads_.push_back(new std::thread([this]() { WorkerLoop(); })); } -- cgit v1.2.3