mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09:00
Kernel: Require a reason to be passed to Thread::wait_on
The Lock class still permits no reason, but for everything else require a reason to be passed to Thread::wait_on. This makes it easier to diagnose why a Thread is in Queued state.
This commit is contained in:
parent
0c4b0c0312
commit
788b2d64c6
Notes:
sideshowbarker
2024-07-19 05:07:41 +09:00
Author: https://github.com/tomuta
Commit: 788b2d64c6
Pull-request: https://github.com/SerenityOS/serenity/pull/2706
Reviewed-by: https://github.com/awesomekling
11 changed files with 19 additions and 11 deletions
|
@ -852,7 +852,7 @@ const LogStream& operator<<(const LogStream& stream, const Thread& value)
|
|||
return stream << value.process().name() << "(" << value.pid() << ":" << value.tid() << ")";
|
||||
}
|
||||
|
||||
Thread::BlockResult Thread::wait_on(WaitQueue& queue, timeval* timeout, Atomic<bool>* lock, Thread* beneficiary, const char* reason)
|
||||
Thread::BlockResult Thread::wait_on(WaitQueue& queue, const char* reason, timeval* timeout, Atomic<bool>* lock, Thread* beneficiary)
|
||||
{
|
||||
TimerId timer_id {};
|
||||
u32 prev_crit;
|
||||
|
@ -864,6 +864,7 @@ Thread::BlockResult Thread::wait_on(WaitQueue& queue, timeval* timeout, Atomic<b
|
|||
if (lock)
|
||||
*lock = false;
|
||||
set_state(State::Queued);
|
||||
m_wait_reason = reason;
|
||||
queue.enqueue(*Thread::current());
|
||||
|
||||
|
||||
|
@ -899,6 +900,7 @@ void Thread::wake_from_queue()
|
|||
{
|
||||
ScopedSpinLock lock(g_scheduler_lock);
|
||||
ASSERT(state() == State::Queued);
|
||||
m_wait_reason = nullptr;
|
||||
if (this != Thread::current())
|
||||
set_state(State::Runnable);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue