SMP and timer interrupts
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
#include <libk/std.h>
|
||||
#include <sync/spin_lock.h>
|
||||
#include <sys/irq.h>
|
||||
#include <sys/spin_lock.h>
|
||||
|
||||
void spin_lock (spin_lock_t* sl) {
|
||||
irq_save ();
|
||||
|
||||
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); }
|
||||
void spin_unlock (spin_lock_t* sl) {
|
||||
atomic_flag_clear_explicit (sl, memory_order_release);
|
||||
|
||||
irq_restore ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user