Skip to content

Commit b59a1ee

Browse files
ryanbreenclaude
andcommitted
Fix cooperative scheduling busy-wait issue
The wait_for_pid_exit function was spinning in a tight loop without yielding control, preventing the context switch from actually happening. This fix replaces the spin loop with yield_current() to allow the scheduler to run the target process. This is the critical fix for the CI syscall test failure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent cb29257 commit b59a1ee

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

kernel/src/task/scheduler.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,9 @@ pub fn wait_for_pid_exit(pid: crate::process::ProcessId, timeout_ms: u64) -> Pro
366366
}
367367
}
368368

369-
// Small delay to prevent busy waiting
370-
for _ in 0..100000 {
371-
core::hint::spin_loop();
372-
}
369+
// Actually yield control to allow other processes to run
370+
// This is the key fix - we need to yield so the context switch can happen
371+
yield_current();
373372
}
374373

375374
ProcessExitStatus::StillRunning

0 commit comments

Comments
 (0)