Merge branch 'master' into cxx17

This commit is contained in:
Stephen Seo 2021-09-07 20:25:10 +09:00
commit 5baa4e92b7
2 changed files with 18 additions and 0 deletions

View file

@ -172,6 +172,13 @@ public:
return fnQueue.empty();
}
/*!
\brief Returns the ThreadCount that this class was created with.
*/
constexpr unsigned int getThreadCount() {
return SIZE;
}
private:
std::vector<std::thread> threads;
std::atomic_bool isAlive;

View file

@ -66,3 +66,14 @@ TEST(ECThreadPool, Simple) {
ASSERT_EQ(data.load(), 11);
}
TEST(ECThreadPool, QueryCount) {
{
OneThreadPool oneP;
ASSERT_EQ(1, oneP.getThreadCount());
}
{
ThreeThreadPool threeP;
ASSERT_EQ(3, threeP.getThreadCount());
}
}