1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:05:06 +00:00

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
parent 39e2b69153
commit 73d6a69b3f
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)