Commit 35153a97 authored by Etienne Pierre-doray's avatar Etienne Pierre-doray Committed by Commit Bot

[ThreadPool]: Fix JoinJobTaskSource

Problem: EXPECT_EQ(1U, task_source->HasOneRef()) fails because threads don't
release ref right away.
Fix: use JoinForTesting

Bug: 1011502
Change-Id: I4f5c7da2d3cf66cd6635a97c4b99acba866c2db3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845232
Commit-Queue: François Doray <fdoray@chromium.org>
Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703689}
parent 91795f43
...@@ -801,7 +801,10 @@ TEST_P(ThreadGroupTest, JoinJobTaskSource) { ...@@ -801,7 +801,10 @@ TEST_P(ThreadGroupTest, JoinJobTaskSource) {
job_handle.Join(); job_handle.Join();
// All worker tasks should complete before Join() returns. // All worker tasks should complete before Join() returns.
EXPECT_EQ(0U, job_task->GetMaxConcurrency()); EXPECT_EQ(0U, job_task->GetMaxConcurrency());
thread_group_->JoinForTesting();
EXPECT_EQ(1U, task_source->HasOneRef()); EXPECT_EQ(1U, task_source->HasOneRef());
// Prevent TearDown() from calling JoinForTesting() again.
thread_group_ = nullptr;
} }
// Verify that the maximum number of BEST_EFFORT tasks that can run concurrently // Verify that the maximum number of BEST_EFFORT tasks that can run concurrently
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment