aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-10-15 17:20:40 -0400
committerDave Barach <dave@barachs.net>2017-10-16 18:34:33 -0400
commit50328c9d1e2b9a6753d82f3d00f64c48d2b39efd (patch)
tree4ef05bf7ea41913e6430c3b8ff78a3b4d7cd5ba4 /src
parent1999e983c5537a43bc543d92a42e778bd43b22f9 (diff)
VPP-1031: Fix minor issues in clib_spinlock_unlock()
Change-Id: I20ce799c9dd57332c06003b466ee7c36169bce98 Signed-off-by: Dave Barach <dave@barachs.net> (cherry picked from commit fa77e8fb1cc8a87a4a31792698e7200c4195583e)
Diffstat (limited to 'src')
-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