From 3a054d37c1f5323462bd77f55be02c5b0d764611 Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Mon, 28 Sep 2015 15:40:15 -0700 Subject: dropped unused SpinLockWait function --- src/base/spinlock.cc | 2 +- src/base/spinlock_internal.cc | 20 -------------------- src/base/spinlock_internal.h | 14 -------------- 3 files changed, 1 insertion(+), 35 deletions(-) diff --git a/src/base/spinlock.cc b/src/base/spinlock.cc index 2021fec..088785f 100644 --- a/src/base/spinlock.cc +++ b/src/base/spinlock.cc @@ -114,7 +114,7 @@ void SpinLock::SlowLock() { kSpinLockSleeper); if (lock_value == kSpinLockHeld) { // Successfully transitioned to kSpinLockSleeper. Pass - // kSpinLockSleeper to the SpinLockWait routine to properly indicate + // kSpinLockSleeper to the SpinLockDelay routine to properly indicate // the last lock_value observed. lock_value = kSpinLockSleeper; } else if (lock_value == kSpinLockFree) { diff --git a/src/base/spinlock_internal.cc b/src/base/spinlock_internal.cc index e090f9b..d962971 100644 --- a/src/base/spinlock_internal.cc +++ b/src/base/spinlock_internal.cc @@ -57,26 +57,6 @@ namespace base { namespace internal { static int SuggestedDelayNS(int loop); }} namespace base { namespace internal { -// See spinlock_internal.h for spec. -int32 SpinLockWait(volatile Atomic32 *w, int n, - const SpinLockWaitTransition trans[]) { - int32 v; - bool done = false; - for (int loop = 0; !done; loop++) { - v = base::subtle::Acquire_Load(w); - int i; - for (i = 0; i != n && v != trans[i].from; i++) { - } - if (i == n) { - SpinLockDelay(w, v, loop); // no matching transition - } else if (trans[i].to == v || // null transition - base::subtle::Acquire_CompareAndSwap(w, v, trans[i].to) == v) { - done = trans[i].done; - } - } - return v; -} - // Return a suggested delay in nanoseconds for iteration number "loop" static int SuggestedDelayNS(int loop) { // Weak pseudo-random number generator to get some spread between threads diff --git a/src/base/spinlock_internal.h b/src/base/spinlock_internal.h index 4d3c17f..aa47e67 100644 --- a/src/base/spinlock_internal.h +++ b/src/base/spinlock_internal.h @@ -43,20 +43,6 @@ namespace base { namespace internal { -// SpinLockWait() waits until it can perform one of several transitions from -// "from" to "to". It returns when it performs a transition where done==true. -struct SpinLockWaitTransition { - int32 from; - int32 to; - bool done; -}; - -// Wait until *w can transition from trans[i].from to trans[i].to for some i -// satisfying 0<=i