mirror of
https://github.com/rdmsr/zag.git
synced 2026-10-27 13:58:20 +00:00
ke: add is_locked to mutex
This commit is contained in:
@@ -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.?;
|
||||||
|
|||||||
Reference in New Issue
Block a user