From be6648c0eefebc1b346966892e4da8ce435e5bf8 Mon Sep 17 00:00:00 2001 From: Oleksandr Babak Date: Thu, 3 Apr 2025 10:10:10 +0200 Subject: [PATCH] fix: move the popped check after the fence --- rtic-common/src/wait_queue.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rtic-common/src/wait_queue.rs b/rtic-common/src/wait_queue.rs index 8a3f80ea7ec..0f3a59d1542 100644 --- a/rtic-common/src/wait_queue.rs +++ b/rtic-common/src/wait_queue.rs @@ -141,11 +141,12 @@ impl Link { /// Remove this link from a linked list. pub fn remove_from_list(&self, list: &DoublyLinkedList) { cs::with(|_| { + // Make sure all previous writes are visible + core::sync::atomic::fence(Ordering::SeqCst); + if self.is_popped() { return; } - // Make sure all previous writes are visible - core::sync::atomic::fence(Ordering::SeqCst); let prev = self.prev.load(Self::R); let next = self.next.load(Self::R);