From 8013e84d9ff61822c30553691e93b01fcda91f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gr=C3=A9goire?= Date: Sun, 20 Sep 2026 00:24:44 -0400 Subject: [PATCH] ke/sched: style fixes --- src/kern/sched.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/kern/sched.zig b/src/kern/sched.zig index 3513962..ba64ccd 100644 --- a/src/kern/sched.zig +++ b/src/kern/sched.zig @@ -1318,7 +1318,12 @@ pub fn yield_locked(continuation: ?ke.Continuation) void { break; } - while (cur != next and next.?.switching.load(.monotonic) == true) { + if (next == cur) { + // We just selected the same thread again. + break; + } + + while (next.?.switching.load(.monotonic) == true) { std.atomic.spinLoopHint(); } @@ -1369,7 +1374,8 @@ pub fn yield_locked(continuation: ?ke.Continuation) void { cur.switching.store(false, .monotonic); cur.lock.release_no_ipl(); - if (cont) |c| kep.impl.call_continuation(&cur.context, c); + if (cont) |c| + kep.impl.call_continuation(&cur.context, c); } // cur lock dropped