13 lines
302 B
C
13 lines
302 B
C
#include <libk/std.h>
|
|
#include <sys/spin_lock.h>
|
|
#include <sync/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);
|
|
}
|