Skip to content

Commit ad2afa5

Browse files
committed
fix: add spin wait for SharedUICommand::clear() and SharedUICommand::kindFlag();
1 parent 190b306 commit ad2afa5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bridge/foundation/shared_ui_command.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ void* SharedUICommand::data() {
4444
}
4545

4646
uint32_t SharedUICommand::kindFlag() {
47+
// simply spin wait for the swapBuffers to finish.
48+
while (is_blocking_writing_.load(std::memory_order::memory_order_acquire)) {
49+
}
50+
4751
return active_buffer->kindFlag();
4852
}
4953

@@ -54,6 +58,9 @@ int64_t SharedUICommand::size() {
5458

5559
// third called by dart to clear commands.
5660
void SharedUICommand::clear() {
61+
// simply spin wait for the swapBuffers to finish.
62+
while (is_blocking_writing_.load(std::memory_order::memory_order_acquire)) {
63+
}
5764
active_buffer->clear();
5865
}
5966

0 commit comments

Comments
 (0)