aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-09-12 10:31:55 -0700
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-09-12 10:31:55 -0700
commiteb6ba00cc8a7e3164b19955a38ad94491d5a17e9 (patch)
treeee61bc511628363e04891935e8e0bd15214b7e69 /unsupported
parenta618094b6269f2d5ab9be4ba6f01cb839e1f006f (diff)
Properly size the list of waiters
Diffstat (limited to 'unsupported')
-rw-r--r--unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h2
-rw-r--r--unsupported/test/cxx11_eventcount.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h b/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h
index 9f4e318e5..354bce52a 100644
--- a/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h
+++ b/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h
@@ -29,6 +29,8 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
spinning_(0),
done_(false),
ec_(waiters_) {
+ waiters_.resize(num_threads);
+
// Calculate coprimes of num_threads.
// Coprimes are used for a random walk over all threads in Steal
// and NonEmptyQueueIndex. Iteration is based on the fact that if we take
diff --git a/unsupported/test/cxx11_eventcount.cpp b/unsupported/test/cxx11_eventcount.cpp
index 366df9cee..3b598bf42 100644
--- a/unsupported/test/cxx11_eventcount.cpp
+++ b/unsupported/test/cxx11_eventcount.cpp
@@ -26,6 +26,7 @@ int rand_reentrant(unsigned int* s) {
static void test_basic_eventcount()
{
MaxSizeVector<EventCount::Waiter> waiters(1);
+ waiters.resize(1);
EventCount ec(waiters);
EventCount::Waiter& w = waiters[0];
ec.Notify(false);
@@ -82,6 +83,7 @@ static void test_stress_eventcount()
static const int kQueues = 10;
MaxSizeVector<EventCount::Waiter> waiters(kThreads);
+ waiters.resize(kThreads);
EventCount ec(waiters);
TestQueue queues[kQueues];