Skip to content

Commit

Permalink
fix: add spin wait for SharedUICommand::clear() and SharedUICommand::…
Browse files Browse the repository at this point in the history
…kindFlag();
  • Loading branch information
andycall committed Aug 21, 2024
1 parent ca35ee7 commit 64648e4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bridge/foundation/shared_ui_command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ void* SharedUICommand::data() {
}

uint32_t SharedUICommand::kindFlag() {
// simply spin wait for the swapBuffers to finish.
while (is_blocking_writing_.load(std::memory_order::memory_order_acquire)) {
}

return active_buffer->kindFlag();
}

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

// third called by dart to clear commands.
void SharedUICommand::clear() {
// simply spin wait for the swapBuffers to finish.
while (is_blocking_writing_.load(std::memory_order::memory_order_acquire)) {
}
active_buffer->clear();
}

Expand Down

0 comments on commit 64648e4

Please sign in to comment.