WIP convert Manager to use ThreadPool

valgrind seems to report memory issues, and documentation may need more
updating.
This commit is contained in:
Stephen Seo 2021-09-06 19:52:23 +09:00
parent 2e9e18a964
commit f44d2f8c7b
2 changed files with 436 additions and 399 deletions

File diff suppressed because it is too large Load diff

View file

@ -464,7 +464,7 @@ TEST(EC, MultiThreaded)
c->y = 2; c->y = 2;
}, },
nullptr, nullptr,
2 true
); );
for(unsigned int i = 0; i < 17; ++i) for(unsigned int i = 0; i < 17; ++i)
@ -490,7 +490,7 @@ TEST(EC, MultiThreaded)
c->y = 4; c->y = 4;
}, },
nullptr, nullptr,
8 true
); );
for(unsigned int i = 0; i < 3; ++i) for(unsigned int i = 0; i < 3; ++i)
@ -516,7 +516,7 @@ TEST(EC, MultiThreaded)
} }
); );
manager.callForMatchingFunctions(2); manager.callForMatchingFunctions(true);
for(unsigned int i = 0; i < 17; ++i) for(unsigned int i = 0; i < 17; ++i)
{ {
@ -531,7 +531,7 @@ TEST(EC, MultiThreaded)
} }
); );
manager.callForMatchingFunction(f1, 4); manager.callForMatchingFunction(f1, true);
for(unsigned int i = 0; i < 17; ++i) for(unsigned int i = 0; i < 17; ++i)
{ {
@ -544,7 +544,7 @@ TEST(EC, MultiThreaded)
manager.deleteEntity(i); manager.deleteEntity(i);
} }
manager.callForMatchingFunction(f0, 8); manager.callForMatchingFunction(f0, true);
for(unsigned int i = 0; i < 4; ++i) for(unsigned int i = 0; i < 4; ++i)
{ {
@ -710,7 +710,7 @@ TEST(EC, ForMatchingSignatures)
c0->y = 2; c0->y = 2;
}), }),
nullptr, nullptr,
3 true
); );
for(auto iter = cx.begin(); iter != cx.end(); ++iter) for(auto iter = cx.begin(); iter != cx.end(); ++iter)
@ -850,7 +850,7 @@ TEST(EC, forMatchingPtrs)
&func0 &func0
); );
manager.forMatchingSignaturePtr<TypeList<C0, T0> >( manager.forMatchingSignaturePtr<TypeList<C0, T0> >(
&func1 &func1, nullptr, true
); );
for(auto eid : e) for(auto eid : e)
@ -1098,7 +1098,7 @@ TEST(EC, forMatchingSimple) {
C0 *c0 = manager->getEntityData<C0>(id); C0 *c0 = manager->getEntityData<C0>(id);
c0->x += 10; c0->x += 10;
c0->y += 10; c0->y += 10;
}, nullptr, 3); }, nullptr, true);
// verify // verify
{ {
@ -1296,7 +1296,7 @@ TEST(EC, forMatchingIterableFn)
c->x += 100; c->x += 100;
c->y += 100; c->y += 100;
}; };
manager.forMatchingIterable(iterable, fn, nullptr, 3); manager.forMatchingIterable(iterable, fn, nullptr, true);
} }
{ {
@ -1322,7 +1322,7 @@ TEST(EC, forMatchingIterableFn)
c->x += 1000; c->x += 1000;
c->y += 1000; c->y += 1000;
}; };
manager.forMatchingIterable(iterable, fn, nullptr, 3); manager.forMatchingIterable(iterable, fn, nullptr, true);
} }
{ {
@ -1365,7 +1365,7 @@ TEST(EC, MultiThreadedForMatching) {
EXPECT_TRUE(manager.isAlive(first)); EXPECT_TRUE(manager.isAlive(first));
EXPECT_TRUE(manager.isAlive(second)); EXPECT_TRUE(manager.isAlive(second));
manager.callForMatchingFunction(fnIdx, 2); manager.callForMatchingFunction(fnIdx, true);
EXPECT_TRUE(manager.isAlive(first)); EXPECT_TRUE(manager.isAlive(first));
EXPECT_FALSE(manager.isAlive(second)); EXPECT_FALSE(manager.isAlive(second));