diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-03-22 14:02:50 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-03-22 14:02:50 -0700 |
commit | 6a31b7be3ea29a5300ff575f0bada876b70904d6 (patch) | |
tree | de2f7426d53050fbd196bc3c2b044b5d63c2a977 /unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h | |
parent | 65a7113a36f70aeca34eac29f32b24ef865cb6e4 (diff) |
Avoid using std::vector whenever possible
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h | 6 |
1 files changed, 3 insertions, 3 deletions
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<std::thread*> threads_; // All threads - std::vector<Waiter*> waiters_; // Stack of waiting threads. + MaxSizeVector<std::thread*> threads_; // All threads + MaxSizeVector<Waiter*> waiters_; // Stack of waiting threads. std::deque<std::function<void()>> pending_; // Queue of pending work std::condition_variable empty_; // Signaled on pending_.empty() bool exiting_ = false; |