diff options
author | Aliaksey Kandratsenka <alk@tut.by> | 2015-09-28 15:40:15 -0700 |
---|---|---|
committer | Aliaksey Kandratsenka <alkondratenko@gmail.com> | 2015-10-05 20:56:28 -0700 |
commit | 3a054d37c1f5323462bd77f55be02c5b0d764611 (patch) | |
tree | 160772ffbff14b79c0bafd7c2844151ae0ac19e0 | |
parent | 5b62d38329f04ee30fb475a36b552c1ebc4e1e79 (diff) | |
download | gperftools-3a054d37c1f5323462bd77f55be02c5b0d764611.tar.gz |
dropped unused SpinLockWait function
-rw-r--r-- | src/base/spinlock.cc | 2 | ||||
-rw-r--r-- | src/base/spinlock_internal.cc | 20 | ||||
-rw-r--r-- | src/base/spinlock_internal.h | 14 |
3 files changed, 1 insertions, 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<n && trans[i].done, atomically make the transition, -// then return the old value of *w. Make any other atomic tranistions -// where !trans[i].done, but continue waiting. -int32 SpinLockWait(volatile Atomic32 *w, int n, - const SpinLockWaitTransition trans[]); void SpinLockWake(volatile Atomic32 *w, bool all); void SpinLockDelay(volatile Atomic32 *w, int32 value, int loop); |