mirror of
https://github.com/gperftools/gperftools
synced 2025-01-25 16:33:52 +00:00
dropped unused SpinLockWait function
This commit is contained in:
parent
5b62d38329
commit
3a054d37c1
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user