diff options
author | sigsegv7 <ian@vegaa.systems> | 2023-09-26 11:53:58 -0400 |
---|---|---|
committer | sigsegv7 <ian@vegaa.systems> | 2023-09-26 12:21:12 -0400 |
commit | 608414ad2679d26d689e32e24ae6b2267cb49bb7 (patch) | |
tree | bdd0c585cc5f93f70adf0ba7d9aae844631e1089 /sys | |
parent | b143f00b1605f588e02349914b6fcb0fd3bab55e (diff) |
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 <ian@vegaa.systems>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/include/sys/spinlock.h | 4 |
1 files changed, 2 insertions, 2 deletions
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 |