From 3f41d7d2eeff0c5c6b350a013b9c2471846c3316 Mon Sep 17 00:00:00 2001 From: "Mr. Jake" Date: Mon, 20 May 2024 00:03:32 +0200 Subject: [PATCH] Added comments referencing spin-lock lock/unlock read/writes (#1501) --- src/rp2_common/hardware_sync/include/hardware/sync.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rp2_common/hardware_sync/include/hardware/sync.h b/src/rp2_common/hardware_sync/include/hardware/sync.h index 91af27f9..44bbc302 100644 --- a/src/rp2_common/hardware_sync/include/hardware/sync.h +++ b/src/rp2_common/hardware_sync/include/hardware/sync.h @@ -262,7 +262,7 @@ __force_inline static void spin_lock_unsafe_blocking(spin_lock_t *lock) { // Note we don't do a wfe or anything, because by convention these spin_locks are VERY SHORT LIVED and NEVER BLOCK and run // with INTERRUPTS disabled (to ensure that)... therefore nothing on our core could be blocking us, so we just need to wait on another core // anyway which should be finished soon - while (__builtin_expect(!*lock, 0)) { + while (__builtin_expect(!*lock, 0)) { // read from spinlock register (tries to acquire the lock) tight_loop_contents(); } __mem_fence_acquire(); @@ -275,7 +275,7 @@ __force_inline static void spin_lock_unsafe_blocking(spin_lock_t *lock) { */ __force_inline static void spin_unlock_unsafe(spin_lock_t *lock) { __mem_fence_release(); - *lock = 0; + *lock = 0; // write to spinlock register (release lock) } /*! \brief Acquire a spin lock safely