acadia/zion/lib/mutex.cpp
Drew Galbraith 6986f534f8 Add a method for blocking threads on ports.
Additionally add the first lock class since we are becoming more
concurrent.
2023-06-12 20:56:25 -07:00

11 lines
241 B
C++

#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) {
dbgln("Lock sleep: %s", name_);
gScheduler->Preempt();
}
}