Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Fix a memory error in a multithreaded test #51951

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions shell/platform/embedder/tests/embedder_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3446,22 +3446,29 @@ TEST_F(EmbedderTest, EmbedderThreadHostUseCustomThreadConfig) {
flutter::EmbedderThreadHost::CreateEmbedderOrEngineManagedThreadHost(
nullptr, MockThreadConfigSetter);

fml::AutoResetWaitableEvent ui_latch;
int ui_policy;
struct sched_param ui_param;

thread_host->GetTaskRunners().GetUITaskRunner()->PostTask([&] {
pthread_t current_thread = pthread_self();
pthread_getschedparam(current_thread, &ui_policy, &ui_param);
ASSERT_EQ(ui_param.sched_priority, 10);
ui_latch.Signal();
});

fml::AutoResetWaitableEvent io_latch;
int io_policy;
struct sched_param io_param;
thread_host->GetTaskRunners().GetIOTaskRunner()->PostTask([&] {
pthread_t current_thread = pthread_self();
pthread_getschedparam(current_thread, &io_policy, &io_param);
ASSERT_EQ(io_param.sched_priority, 1);
io_latch.Signal();
});

ui_latch.Wait();
io_latch.Wait();
}
#endif

Expand Down