Files
mop3/kernel/sync/spin_lock.c
kamkow1 e5ebd7f3ba
All checks were successful
Build ISO image / build-and-deploy (push) Successful in 2m21s
Build documentation / build-and-deploy (push) Successful in 54s
Use a big-lock for kernel sychronization instead of fine-grained locking
2026-04-27 18:06:02 +02:00

11 lines
300 B
C

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