ke: add is_locked to mutex

This commit is contained in:
Loïc Grégoire
2026-06-29 22:32:41 -04:00
parent a9c933114d
commit 11c858c5e8
+4
View File
@@ -13,6 +13,10 @@ pub const Mutex = struct {
return .{ .owner = .init(null) }; return .{ .owner = .init(null) };
} }
pub fn is_locked(self: *Mutex) bool {
return self.owner.load(.monotonic) != null;
}
pub fn acquire(m: *Mutex) void { pub fn acquire(m: *Mutex) void {
const ipl = ke.ipl.raise(.Dispatch); const ipl = ke.ipl.raise(.Dispatch);
const curtd = ki.sched.percpu.local().current_thread.?; const curtd = ki.sched.percpu.local().current_thread.?;