2023-06-12 20:56:25 -07:00
|
|
|
#include "lib/mutex.h"
|
|
|
|
|
|
|
|
#include "debug/debug.h"
|
|
|
|
#include "scheduler/scheduler.h"
|
|
|
|
|
|
|
|
void Mutex::Lock() {
|
|
|
|
while (__atomic_fetch_or(&lock_, 0x1, __ATOMIC_SEQ_CST) == 0x1) {
|
2023-06-21 23:14:42 -07:00
|
|
|
// dbgln("Lock sleep: %s", name_);
|
2023-06-12 20:56:25 -07:00
|
|
|
gScheduler->Preempt();
|
|
|
|
}
|
|
|
|
}
|