mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 23:28:12 +00:00
Kernel: Make it easier to add Thread block states in the future.
This commit is contained in:
parent
302cae5c2f
commit
54e79a4640
2 changed files with 7 additions and 1 deletions
|
@ -181,6 +181,9 @@ const char* to_string(Thread::State state)
|
||||||
return "Receive";
|
return "Receive";
|
||||||
case Thread::BlockedSnoozing:
|
case Thread::BlockedSnoozing:
|
||||||
return "Snoozing";
|
return "Snoozing";
|
||||||
|
case Thread::__Begin_Blocked_States__:
|
||||||
|
case Thread::__End_Blocked_States__:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
kprintf("to_string(Thread::State): Invalid state: %u\n", state);
|
kprintf("to_string(Thread::State): Invalid state: %u\n", state);
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
|
|
|
@ -61,6 +61,8 @@ public:
|
||||||
Dying,
|
Dying,
|
||||||
Dead,
|
Dead,
|
||||||
Stopped,
|
Stopped,
|
||||||
|
|
||||||
|
__Begin_Blocked_States__,
|
||||||
BlockedLurking,
|
BlockedLurking,
|
||||||
BlockedSleep,
|
BlockedSleep,
|
||||||
BlockedWait,
|
BlockedWait,
|
||||||
|
@ -71,6 +73,7 @@ public:
|
||||||
BlockedConnect,
|
BlockedConnect,
|
||||||
BlockedReceive,
|
BlockedReceive,
|
||||||
BlockedSnoozing,
|
BlockedSnoozing,
|
||||||
|
__End_Blocked_States__
|
||||||
};
|
};
|
||||||
|
|
||||||
void did_schedule() { ++m_times_scheduled; }
|
void did_schedule() { ++m_times_scheduled; }
|
||||||
|
@ -79,7 +82,7 @@ public:
|
||||||
bool is_stopped() const { return m_state == Stopped; }
|
bool is_stopped() const { return m_state == Stopped; }
|
||||||
bool is_blocked() const
|
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; }
|
bool in_kernel() const { return (m_tss.cs & 0x03) == 0; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue