summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vppinfra/lock.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vppinfra/lock.h b/src/vppinfra/lock.h
index 0cd2b4fea53..7d241675b12 100644
--- a/src/vppinfra/lock.h
+++ b/src/vppinfra/lock.h
@@ -71,12 +71,14 @@ clib_spinlock_lock_if_init (clib_spinlock_t * p)
static_always_inline void
clib_spinlock_unlock (clib_spinlock_t * p)
{
- (*p)->lock = 0;
#if CLIB_DEBUG > 0
(*p)->frame_address = 0;
(*p)->pid = 0;
(*p)->thread_index = 0;
#endif
+ /* Make sure all writes are complete before releasing the lock */
+ CLIB_MEMORY_BARRIER ();
+ (*p)->lock = 0;
}
static_always_inline void