diff options
Diffstat (limited to 'spinlock.c')
-rw-r--r-- | spinlock.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -36,6 +36,13 @@ getcallerpcs(void *v, uint pcs[]) pcs[i] = 0; } +// Check whether this cpu is holding the lock. +int +holding(struct spinlock *lock) +{ + return lock->locked && lock->cpu == cpu() + 10; +} + // Acquire the lock. // Loops (spins) until the lock is acquired. // (Because contention is handled by spinning, @@ -83,11 +90,3 @@ release(struct spinlock *lock) if(--cpus[cpu()].nlock == 0) sti(); } - -// Check whether this cpu is holding the lock. -int -holding(struct spinlock *lock) -{ - return lock->locked && lock->cpu == cpu() + 10; -} - |