From d751219f038d85bb3826b36fb5b87270433e2178 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 20 Aug 2025 04:12:00 +0000 Subject: 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 --- sys/kern/kern_synch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sys/kern/kern_synch.c') 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 -- cgit v1.2.3