1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00: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:
Tom 2020-07-04 15:55:20 -06:00 committed by Andreas Kling
parent 0c4b0c0312
commit 788b2d64c6
11 changed files with 19 additions and 11 deletions

View file

@ -340,7 +340,7 @@ public:
return block<ConditionBlocker>(state_string, move(condition));
}
BlockResult wait_on(WaitQueue& queue, timeval* timeout = nullptr, Atomic<bool>* lock = nullptr, Thread* beneficiary = nullptr, const char* reason = nullptr);
BlockResult wait_on(WaitQueue& queue, const char* reason, timeval* timeout = nullptr, Atomic<bool>* lock = nullptr, Thread* beneficiary = nullptr);
void wake_from_queue();
void unblock();
@ -433,6 +433,11 @@ public:
m_ipv4_socket_write_bytes += bytes;
}
const char* wait_reason() const
{
return m_wait_reason;
}
Thread* clone(Process&);
template<typename Callback>
@ -484,6 +489,7 @@ private:
size_t m_thread_specific_region_size { 0 };
SignalActionData m_signal_action_data[32];
Blocker* m_blocker { nullptr };
const char* m_wait_reason { nullptr };
bool m_is_joinable { true };
Thread* m_joiner { nullptr };