summaryrefslogtreecommitdiff
path: root/spinlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'spinlock.c')
-rw-r--r--spinlock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/spinlock.c b/spinlock.c
index af33f7d..e728460 100644
--- a/spinlock.c
+++ b/spinlock.c
@@ -29,7 +29,7 @@ getcallerpcs(void *v, uint pcs[])
}
void
-acquire(struct spinlock * lock)
+acquire(struct spinlock *lock)
{
if(holding(lock))
panic("acquire");
@@ -37,7 +37,7 @@ acquire(struct spinlock * lock)
if(cpus[cpu()].nlock == 0)
cli();
cpus[cpu()].nlock++;
-
+
while(cmpxchg(0, 1, &lock->locked) == 1)
;
cpuid(0, 0, 0, 0, 0); // memory barrier
@@ -46,7 +46,7 @@ acquire(struct spinlock * lock)
}
void
-release(struct spinlock * lock)
+release(struct spinlock *lock)
{
if(!holding(lock))