summaryrefslogtreecommitdiff
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-12-15 22:50:56 -0500
committerIan Moffett <ian@osmora.org>2024-12-15 22:50:56 -0500
commit5504521882fc4f12dc0c25fea57d53c583789492 (patch)
tree583714eb8737d8f2f4dfaf54d712dd237153150a /sys/kern/kern_synch.c
parente0928e6ddf94c25f026d02643ddd0a2016ddd17b (diff)
kernel: synch: kern_lock.c -> kern_synch.c
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c12
1 files changed, 12 insertions, 0 deletions
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);
+}