mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 11:42:38 +03:00
Kernel: Make it easier to add Thread block states in the future.
This commit is contained in:
parent
302cae5c2f
commit
54e79a4640
Notes:
sideshowbarker
2024-07-19 13:17:44 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/54e79a46407
@ -181,6 +181,9 @@ const char* to_string(Thread::State state)
|
||||
return "Receive";
|
||||
case Thread::BlockedSnoozing:
|
||||
return "Snoozing";
|
||||
case Thread::__Begin_Blocked_States__:
|
||||
case Thread::__End_Blocked_States__:
|
||||
break;
|
||||
}
|
||||
kprintf("to_string(Thread::State): Invalid state: %u\n", state);
|
||||
ASSERT_NOT_REACHED();
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
Dying,
|
||||
Dead,
|
||||
Stopped,
|
||||
|
||||
__Begin_Blocked_States__,
|
||||
BlockedLurking,
|
||||
BlockedSleep,
|
||||
BlockedWait,
|
||||
@ -71,6 +73,7 @@ public:
|
||||
BlockedConnect,
|
||||
BlockedReceive,
|
||||
BlockedSnoozing,
|
||||
__End_Blocked_States__
|
||||
};
|
||||
|
||||
void did_schedule() { ++m_times_scheduled; }
|
||||
@ -79,7 +82,7 @@ public:
|
||||
bool is_stopped() const { return m_state == Stopped; }
|
||||
bool is_blocked() const
|
||||
{
|
||||
return m_state == BlockedSleep || m_state == BlockedWait || m_state == BlockedRead || m_state == BlockedWrite || m_state == BlockedSignal || m_state == BlockedSelect;
|
||||
return m_state > __Begin_Blocked_States__ && m_state < __End_Blocked_States__;
|
||||
}
|
||||
bool in_kernel() const { return (m_tss.cs & 0x03) == 0; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user