summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-08-20 04:12:00 +0000
committerIan Moffett <ian@osmora.org>2025-08-20 04:12:00 +0000
commitd751219f038d85bb3826b36fb5b87270433e2178 (patch)
tree07955425252af8c1f855221a08b2b3e430b5103d
parent74101c4128d8a4fc0e71be329865ca5d21c96ace (diff)
kernel: Do not spin in spinlock_try_acquire()
The spinlock_try_acquire() function should *not* block as it is meant to simply attempt to acquire the lock and return its status. Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/kern/kern_synch.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 497aff7..2ac39c8 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -110,8 +110,7 @@ spinlock_try_acquire(struct spinlock *lock)
return 1;
}
- while (__atomic_test_and_set(&lock->lock, __ATOMIC_ACQUIRE));
- return 0;
+ return __atomic_test_and_set(&lock->lock, __ATOMIC_ACQUIRE);
}
void