Files
mop3/kernel/sync/spin_lock.c
2026-03-12 22:48:34 +01:00

15 lines
407 B
C

#include <libk/std.h>
#include <sync/spin_lock.h>
#include <sys/spin_lock.h>
void spin_lock (spin_lock_t* sl, uint64_t* flags) {
spin_lock_save_flags (flags);
while (atomic_flag_test_and_set_explicit (sl, memory_order_acquire))
spin_lock_relax ();
}
void spin_unlock (spin_lock_t* sl, uint64_t flags) {
atomic_flag_clear_explicit (sl, memory_order_release);
spin_lock_restore_flags (flags);
}