From 5504521882fc4f12dc0c25fea57d53c583789492 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 15 Dec 2024 22:50:56 -0500 Subject: kernel: synch: kern_lock.c -> kern_synch.c Signed-off-by: Ian Moffett --- sys/kern/kern_synch.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sys/kern/kern_synch.c') diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 1b78642..67ef617 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -71,3 +71,15 @@ spinlock_usleep(struct spinlock *lock, size_t usec_max) return 0; } + +void +spinlock_acquire(struct spinlock *lock) +{ + while (__atomic_test_and_set(&lock->lock, __ATOMIC_ACQUIRE)); +} + +void +spinlock_release(struct spinlock *lock) +{ + __atomic_clear(&lock->lock, __ATOMIC_RELEASE); +} -- cgit v1.2.3