mirror of
https://github.com/RGBCube/serenity
synced 2025-05-26 01:45:06 +00:00
Kernel: Rename Condition state to Blocked now we only have one blocking mechanism :)
This commit is contained in:
parent
d2ca91c024
commit
b13f1699fc
3 changed files with 7 additions and 17 deletions
|
@ -216,10 +216,6 @@ bool Thread::SemiPermanentBlocker::should_unblock(Thread&, time_t, long)
|
||||||
void Thread::consider_unblock(time_t now_sec, long now_usec)
|
void Thread::consider_unblock(time_t now_sec, long now_usec)
|
||||||
{
|
{
|
||||||
switch (state()) {
|
switch (state()) {
|
||||||
case Thread::__Begin_Blocked_States__:
|
|
||||||
case Thread::__End_Blocked_States__:
|
|
||||||
ASSERT_NOT_REACHED();
|
|
||||||
[[fallthrough]];
|
|
||||||
case Thread::Invalid:
|
case Thread::Invalid:
|
||||||
case Thread::Runnable:
|
case Thread::Runnable:
|
||||||
case Thread::Running:
|
case Thread::Running:
|
||||||
|
@ -227,7 +223,7 @@ void Thread::consider_unblock(time_t now_sec, long now_usec)
|
||||||
case Thread::Stopped:
|
case Thread::Stopped:
|
||||||
/* don't know, don't care */
|
/* don't know, don't care */
|
||||||
return;
|
return;
|
||||||
case Thread::BlockedCondition:
|
case Thread::Blocked:
|
||||||
ASSERT(m_blocker);
|
ASSERT(m_blocker);
|
||||||
if (m_blocker->should_unblock(*this, now_sec, now_usec)) {
|
if (m_blocker->should_unblock(*this, now_sec, now_usec)) {
|
||||||
unblock();
|
unblock();
|
||||||
|
|
|
@ -111,7 +111,7 @@ void Thread::unblock()
|
||||||
void Thread::block_until(Function<bool()>&& condition)
|
void Thread::block_until(Function<bool()>&& condition)
|
||||||
{
|
{
|
||||||
m_blocker = make<ConditionBlocker>(condition);
|
m_blocker = make<ConditionBlocker>(condition);
|
||||||
block(Thread::BlockedCondition);
|
block(Thread::Blocked);
|
||||||
Scheduler::yield();
|
Scheduler::yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ void Thread::block(Thread::State new_state)
|
||||||
void Thread::block(Blocker& blocker)
|
void Thread::block(Blocker& blocker)
|
||||||
{
|
{
|
||||||
m_blocker = &blocker;
|
m_blocker = &blocker;
|
||||||
block(Thread::BlockedCondition);
|
block(Thread::Blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 Thread::sleep(u32 ticks)
|
u64 Thread::sleep(u32 ticks)
|
||||||
|
@ -162,11 +162,8 @@ const char* to_string(Thread::State state)
|
||||||
return "Skip1";
|
return "Skip1";
|
||||||
case Thread::Skip0SchedulerPasses:
|
case Thread::Skip0SchedulerPasses:
|
||||||
return "Skip0";
|
return "Skip0";
|
||||||
case Thread::BlockedCondition:
|
case Thread::Blocked:
|
||||||
return "Condition";
|
return "Blocked";
|
||||||
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();
|
||||||
|
|
|
@ -63,10 +63,7 @@ public:
|
||||||
Dying,
|
Dying,
|
||||||
Dead,
|
Dead,
|
||||||
Stopped,
|
Stopped,
|
||||||
|
Blocked,
|
||||||
__Begin_Blocked_States__,
|
|
||||||
BlockedCondition,
|
|
||||||
__End_Blocked_States__
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Blocker {
|
class Blocker {
|
||||||
|
@ -176,7 +173,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 > __Begin_Blocked_States__ && m_state < __End_Blocked_States__;
|
return m_state == Blocked;
|
||||||
}
|
}
|
||||||
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