This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
shell/platform/embedder/tests Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -3943,6 +3943,7 @@ TEST_F(EmbedderTest, CanPostTaskToAllNativeThreads) {
3943
3943
fml::CountDownLatch latch;
3944
3944
3945
3945
// Ensures that the expect number of distinct threads were serviced.
3946
+ std::mutex thread_ids_mutex;
3946
3947
std::set<std::thread::id> thread_ids;
3947
3948
3948
3949
size_t platform_threads_count = 0 ;
@@ -3960,7 +3961,6 @@ TEST_F(EmbedderTest, CanPostTaskToAllNativeThreads) {
3960
3961
engine.get (),
3961
3962
[](FlutterNativeThreadType type, void * baton) {
3962
3963
auto captures = reinterpret_cast <Captures*>(baton);
3963
-
3964
3964
switch (type) {
3965
3965
case kFlutterNativeThreadTypeRender :
3966
3966
captures->render_threads_count ++;
@@ -3975,8 +3975,10 @@ TEST_F(EmbedderTest, CanPostTaskToAllNativeThreads) {
3975
3975
captures->platform_threads_count ++;
3976
3976
break ;
3977
3977
}
3978
-
3979
- captures->thread_ids .insert (std::this_thread::get_id ());
3978
+ {
3979
+ std::scoped_lock lock (captures->thread_ids_mutex );
3980
+ captures->thread_ids .insert (std::this_thread::get_id ());
3981
+ }
3980
3982
captures->latch .CountDown ();
3981
3983
},
3982
3984
&captures),
You can’t perform that action at this time.
0 commit comments