Kernel: Release the big process lock while yielding in sys$yield()

Otherwise, a thread calling sched_yield() will prevent other threads
in that process from entering the kernel.
This commit is contained in:
Andreas Kling 2019-11-16 12:18:59 +01:00
commit 73d6a69b3f
Notes: sideshowbarker 2024-07-19 11:12:36 +09:00
3 changed files with 5 additions and 8 deletions

View file

@ -171,12 +171,8 @@ void Thread::die_if_needed()
Scheduler::pick_next_and_switch_now();
}
void Thread::block_helper()
void Thread::yield_without_holding_big_lock()
{
// This function mostly exists to avoid circular header dependencies. If
// anything needs adding, think carefully about whether it belongs in
// block() instead. Remember that we're unlocking here, so be very careful
// about altering any state once we're unlocked!
bool did_unlock = process().big_lock().unlock_if_locked();
Scheduler::yield();
if (did_unlock)