Testing if submit nThreads pool task successfully.
231 {
232
234
235 auto func = [](int sec) -> bool
236 {
237 std::this_thread::sleep_for(std::chrono::seconds(sec));
238 return true;
239 };
240
241 std::vector<std::future<bool>> futures(nThreads);
242 for (int i = 0; i < nThreads; i++)
243 {
244 futures[i] = m_ThreadPool.SubmitPoolTask(std::bind(func, 2));
245 }
246
247 func(1);
248
249 EXPECT_EQ(m_ThreadPool.GetInitThreadSize() ,nThreads );
250 EXPECT_EQ(m_ThreadPool.GetIdleThreadSize() ,0 );
252 EXPECT_EQ(m_ThreadPool.GetTasks() ,0 );
253 EXPECT_EQ(m_ThreadPool.GetThreadsCount() ,nThreads );
255 EXPECT_EQ(m_ThreadPool.IsPoolRunning() ,true );
256
257
258 m_ThreadPool.Wait();
259
260 EXPECT_EQ(m_ThreadPool.GetInitThreadSize() ,nThreads );
261 EXPECT_EQ(m_ThreadPool.GetIdleThreadSize() ,nThreads );
263 EXPECT_EQ(m_ThreadPool.GetTasks() ,0 );
264 EXPECT_EQ(m_ThreadPool.GetThreadsCount() ,nThreads );
266 EXPECT_EQ(m_ThreadPool.IsPoolRunning() ,true );
267 }
#define SPICESTEST_PROFILE_FUNCTION()
constexpr uint32_t THREAD_MAX_IDLE_TIME