diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index f37ffdd080..2d15eab79d 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -3323,7 +3323,8 @@ int Process::sys$putch(char ch) int Process::sys$yield() { - return Scheduler::yield(); + current->yield_without_holding_big_lock(); + return 0; } int Process::sys$beep() diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index c99d817052..4e4f8fae14 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -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) diff --git a/Kernel/Thread.h b/Kernel/Thread.h index 2f3d89d2a0..0fd9b9ad37 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -267,7 +267,7 @@ public: set_state(Thread::Blocked); // Yield to the scheduler, and wait for us to resume unblocked. - block_helper(); + yield_without_holding_big_lock(); // We should no longer be blocked once we woke up ASSERT(state() != Thread::Blocked); @@ -380,7 +380,7 @@ private: bool m_dump_backtrace_on_finalization { false }; bool m_should_die { false }; - void block_helper(); + void yield_without_holding_big_lock(); }; HashTable& thread_table();