SpiecsEngine
 
Loading...
Searching...
No Matches

◆ TEST_F() [68/72]

SpicesTest::TEST_F ( ThreadPoolFixed_test ,
SubmitVeryMuchPoolTask  )

Testing if submit very much pool task successfully.

Definition at line 323 of file ThreadPoolFixed_test.h.

323 {
324
326
327 auto func = [](int sec) -> bool
328 {
329 std::this_thread::sleep_for(std::chrono::microseconds(sec));
330 return true;
331 };
332
333 std::vector<std::future<bool>> futures(10000);
334 for (int i = 0; i < 10000; i++)
335 {
336 futures[i] = m_ThreadPool.SubmitPoolTask(std::bind(func, 1));
337 }
338
339 /* @brief Wait for subthread finish. */
340 m_ThreadPool.Wait();
341
342 EXPECT_EQ(m_ThreadPool.GetInitThreadSize() ,nThreads );
343 EXPECT_EQ(m_ThreadPool.GetIdleThreadSize() ,nThreads );
344 EXPECT_EQ(m_ThreadPool.GetPoolMode() ,Spices::PoolMode::MODE_FIXED );
345 EXPECT_EQ(m_ThreadPool.GetTasks() ,0 );
346 EXPECT_EQ(m_ThreadPool.GetThreadsCount() ,nThreads );
347 EXPECT_EQ(m_ThreadPool.GetThreadIdleTimeOut(),Spices::THREAD_MAX_IDLE_TIME );
348 EXPECT_EQ(m_ThreadPool.IsPoolRunning() ,true );
349 }
#define SPICESTEST_PROFILE_FUNCTION()
constexpr uint32_t THREAD_MAX_IDLE_TIME