aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
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);
+}