Testing if submit very much mixed task successfully.
385 {
386
388
389 auto func = []() -> void
390 {
391 std::this_thread::sleep_for(std::chrono::microseconds(1));
392 };
393 auto func1 = [](int sec) -> void
394 {
395 std::this_thread::sleep_for(std::chrono::microseconds(sec));
396 };
397
398 for (int i = 0; i < 5000; i++)
399 {
400 m_ThreadPool.SubmitPoolTask(func);
401 }
402
403 for (int i = 0; i < 1000; i++)
404 {
405 m_ThreadPool.SubmitThreadTask_LightWeight_ForEach(func);
406 }
407
408
409 m_ThreadPool.Wait();
410
411 EXPECT_EQ(m_ThreadPool.GetInitThreadSize() ,nThreads );
414 EXPECT_EQ(m_ThreadPool.GetTasks() ,0 );
416 EXPECT_EQ(m_ThreadPool.GetThreadIdleTimeOut(),10 );
417 EXPECT_EQ(m_ThreadPool.IsPoolRunning() ,true );
418
419 for (auto& pair : m_ThreadPool.GetThreads())
420 {
421 EXPECT_EQ(pair.second->GetThreadTasksCount(), 0);
422 }
423
424
425 while (m_ThreadPool.GetThreadsCount() != nThreads)
426 {
427 func1(1000);
428 }
429
430 EXPECT_EQ(m_ThreadPool.GetInitThreadSize() ,nThreads );
431 EXPECT_EQ(m_ThreadPool.GetIdleThreadSize() ,nThreads );
433 EXPECT_EQ(m_ThreadPool.GetTasks() ,0 );
434 EXPECT_EQ(m_ThreadPool.GetThreadsCount() ,nThreads );
435 EXPECT_EQ(m_ThreadPool.GetThreadIdleTimeOut(),10 );
436 EXPECT_EQ(m_ThreadPool.IsPoolRunning() ,true );
437 }
#define SPICESTEST_PROFILE_FUNCTION()
const uint32_t THREAD_MAX_THRESHHOLD