mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
Properly size the list of waiters
This commit is contained in:
parent
a618094b62
commit
eb6ba00cc8
@ -29,6 +29,8 @@ class NonBlockingThreadPoolTempl : public Eigen::ThreadPoolInterface {
|
|||||||
spinning_(0),
|
spinning_(0),
|
||||||
done_(false),
|
done_(false),
|
||||||
ec_(waiters_) {
|
ec_(waiters_) {
|
||||||
|
waiters_.resize(num_threads);
|
||||||
|
|
||||||
// Calculate coprimes of num_threads.
|
// Calculate coprimes of num_threads.
|
||||||
// Coprimes are used for a random walk over all threads in Steal
|
// Coprimes are used for a random walk over all threads in Steal
|
||||||
// and NonEmptyQueueIndex. Iteration is based on the fact that if we take
|
// and NonEmptyQueueIndex. Iteration is based on the fact that if we take
|
||||||
|
@ -26,6 +26,7 @@ int rand_reentrant(unsigned int* s) {
|
|||||||
static void test_basic_eventcount()
|
static void test_basic_eventcount()
|
||||||
{
|
{
|
||||||
MaxSizeVector<EventCount::Waiter> waiters(1);
|
MaxSizeVector<EventCount::Waiter> waiters(1);
|
||||||
|
waiters.resize(1);
|
||||||
EventCount ec(waiters);
|
EventCount ec(waiters);
|
||||||
EventCount::Waiter& w = waiters[0];
|
EventCount::Waiter& w = waiters[0];
|
||||||
ec.Notify(false);
|
ec.Notify(false);
|
||||||
@ -82,6 +83,7 @@ static void test_stress_eventcount()
|
|||||||
static const int kQueues = 10;
|
static const int kQueues = 10;
|
||||||
|
|
||||||
MaxSizeVector<EventCount::Waiter> waiters(kThreads);
|
MaxSizeVector<EventCount::Waiter> waiters(kThreads);
|
||||||
|
waiters.resize(kThreads);
|
||||||
EventCount ec(waiters);
|
EventCount ec(waiters);
|
||||||
TestQueue queues[kQueues];
|
TestQueue queues[kQueues];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user