From 608414ad2679d26d689e32e24ae6b2267cb49bb7 Mon Sep 17 00:00:00 2001 From: sigsegv7 Date: Tue, 26 Sep 2023 11:53:58 -0400 Subject: kernel: Fix spinlock_acquire() flaw This commit fixes a spinlock_acquire() flaw and corrects a [quite an implausible] mistake, in which we do not even spin. It would have been fine how it was before in Vega's contemporary state; however, not a good idea to keep. Signed-off-by: sigsegv7 --- sys/include/sys/spinlock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/include') diff --git a/sys/include/sys/spinlock.h b/sys/include/sys/spinlock.h index 6b1428f..aee852b 100644 --- a/sys/include/sys/spinlock.h +++ b/sys/include/sys/spinlock.h @@ -36,10 +36,10 @@ struct spinlock { volatile _Atomic bool lock; }; -static inline bool +static inline void spinlock_acquire(struct spinlock *lock) { - return __atomic_test_and_set(&lock->lock, __ATOMIC_ACQUIRE); + while (__atomic_test_and_set(&lock->lock, __ATOMIC_ACQUIRE)); } static inline void -- cgit v1.2.3