未验证 提交 532fdc4f 编写于 作者: C Chinmay Garde 提交者: GitHub

Add test to ensure that concurrent message loops have at least one workers. (#16074)

The current count is determined from std::thread::hardware_concurrency which can
return zero. Even in such cases, the implementation may not return a loop with
no workers. There are numerous components that depend on having non-zero workers
in the queue.
上级 53baa7ae
......@@ -284,6 +284,12 @@ TEST(MessageLoop, TaskObserverFire) {
ASSERT_TRUE(terminated);
}
TEST(MessageLoop, ConcurrentMessageLoopHasNonZeroWorkers) {
auto loop = fml::ConcurrentMessageLoop::Create(
0u /* explicitly specify zero workers */);
ASSERT_GT(loop->GetWorkerCount(), 0u);
}
TEST(MessageLoop, CanCreateAndShutdownConcurrentMessageLoopsOverAndOver) {
for (size_t i = 0; i < 10; ++i) {
auto loop = fml::ConcurrentMessageLoop::Create(i + 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册