Skip to content

Commit

Permalink
Add acquire/release to fusing
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 708346752
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Dec 20, 2024
1 parent 05af18d commit f25c07a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions upb/mem/arena.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,15 +439,15 @@ static void _upb_Arena_DoFuseArenaLists(upb_ArenaInternal* const parent,
}

upb_ArenaInternal* displaced =
upb_Atomic_Exchange(&parent_tail->next, child, memory_order_relaxed);
upb_Atomic_Exchange(&parent_tail->next, child, memory_order_release);
parent_tail = upb_Atomic_Load(&child->tail, memory_order_relaxed);

// If we displaced something that got installed racily, we can simply
// reinstall it on our new tail.
child = displaced;
} while (child != NULL);

upb_Atomic_Store(&parent->tail, parent_tail, memory_order_relaxed);
upb_Atomic_Store(&parent->tail, parent_tail, memory_order_release);
}

void upb_Arena_SetAllocCleanup(upb_Arena* a, upb_AllocCleanupFunc* func) {
Expand Down

0 comments on commit f25c07a

Please sign in to comment.