X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Flock.h;h=7d241675b122d920eca5d37a9331d01790b1b0d1;hb=93e658058033e251b98d18a1f0717a07a85adfc2;hp=c60ff4146122d7bfa868e0ef8897967d7a6bdb30;hpb=1927da29ccbe1d4cc8e59ccfa197eb41c257814f;p=vpp.git diff --git a/src/vppinfra/lock.h b/src/vppinfra/lock.h index c60ff414612..7d241675b12 100644 --- a/src/vppinfra/lock.h +++ b/src/vppinfra/lock.h @@ -24,7 +24,7 @@ typedef struct u32 lock; #if CLIB_DEBUG > 0 pid_t pid; - uword cpu_index; + uword thread_index; void *frame_address; #endif } *clib_spinlock_t; @@ -57,7 +57,7 @@ clib_spinlock_lock (clib_spinlock_t * p) #if CLIB_DEBUG > 0 (*p)->frame_address = __builtin_frame_address (0); (*p)->pid = getpid (); - (*p)->cpu_index = os_get_cpu_number (); + (*p)->thread_index = os_get_thread_index (); #endif } @@ -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)->cpu_index = 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