ke/turnstile: add support for multiple owners

This commit is contained in:
Loïc Grégoire
2026-07-23 16:38:59 -04:00
parent 85b0ee5320
commit e4621e03c1
3 changed files with 232 additions and 114 deletions
+2 -1
View File
@@ -59,7 +59,7 @@ pub const Mutex = struct {
}
// Block until woken.
ki.turnstile.block(ts, m, owner.?, .Exclusive);
ki.turnstile.block(ts, m, .{ .single = owner.? }, .Exclusive);
// Re-try acquisition after wakeup.
if (m.owner.cmpxchgStrong(null, curtd, .acquire, .monotonic) == null) {
@@ -87,6 +87,7 @@ pub const Mutex = struct {
// has been shown to be better because this avoids lock convoys, see this mysterious 70s paper:
// https://dl.acm.org/doi/pdf/10.1145/850657.850659
ki.turnstile.wakeup(ts.?, .Exclusive, ts.?.waiters, null);
ki.turnstile.exit(m);
ke.ipl.lower(ipl);
}