From 8343bd4af847734994429c6d16c93d38934510c6 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Sat, 10 Jun 2017 15:03:58 -0400 Subject: [PATCH] spinlock/dec: backoff until lock state transition in lock_eb. This fixes an issue caught by Changwoo Min (@multics69). --- include/spinlock/dec.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/spinlock/dec.h b/include/spinlock/dec.h index 11d36dd..3e36bf7 100644 --- a/include/spinlock/dec.h +++ b/include/spinlock/dec.h @@ -111,7 +111,8 @@ ck_spinlock_dec_lock_eb(struct ck_spinlock_dec *lock) if (r == true) break; - ck_backoff_eb(&backoff); + while (ck_pr_load_uint(&lock->value) != 1) + ck_backoff_eb(&backoff); } ck_pr_fence_lock();