summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorRobin Burchell <robin+git@viroteck.net>2019-07-19 09:37:34 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-19 11:03:22 +0200
commitb13f1699fc646d85e4b78313afd4856923775eb2 (patch)
tree21b962dca7480a5094d0cd57f3889385ed4fa32a /Kernel
parentd2ca91c024e0dca3742715392ad5b2cd6125563f (diff)
downloadserenity-b13f1699fc646d85e4b78313afd4856923775eb2.zip
Kernel: Rename Condition state to Blocked now we only have one blocking mechanism :)
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Scheduler.cpp6
-rw-r--r--Kernel/Thread.cpp11
-rw-r--r--Kernel/Thread.h7
3 files changed, 7 insertions, 17 deletions
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp
index ae9e624c2a..778feee81c 100644
--- a/Kernel/Scheduler.cpp
+++ b/Kernel/Scheduler.cpp
@@ -216,10 +216,6 @@ bool Thread::SemiPermanentBlocker::should_unblock(Thread&, time_t, long)
void Thread::consider_unblock(time_t now_sec, long now_usec)
{
switch (state()) {
- case Thread::__Begin_Blocked_States__:
- case Thread::__End_Blocked_States__:
- ASSERT_NOT_REACHED();
- [[fallthrough]];
case Thread::Invalid:
case Thread::Runnable:
case Thread::Running:
@@ -227,7 +223,7 @@ void Thread::consider_unblock(time_t now_sec, long now_usec)
case Thread::Stopped:
/* don't know, don't care */
return;
- case Thread::BlockedCondition:
+ case Thread::Blocked:
ASSERT(m_blocker);
if (m_blocker->should_unblock(*this, now_sec, now_usec)) {
unblock();
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index f0d21c12b3..13f21485ff 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -111,7 +111,7 @@ void Thread::unblock()
void Thread::block_until(Function<bool()>&& condition)
{
m_blocker = make<ConditionBlocker>(condition);
- block(Thread::BlockedCondition);
+ block(Thread::Blocked);
Scheduler::yield();
}
@@ -132,7 +132,7 @@ void Thread::block(Thread::State new_state)
void Thread::block(Blocker& blocker)
{
m_blocker = &blocker;
- block(Thread::BlockedCondition);
+ block(Thread::Blocked);
}
u64 Thread::sleep(u32 ticks)
@@ -162,11 +162,8 @@ const char* to_string(Thread::State state)
return "Skip1";
case Thread::Skip0SchedulerPasses:
return "Skip0";
- case Thread::BlockedCondition:
- return "Condition";
- case Thread::__Begin_Blocked_States__:
- case Thread::__End_Blocked_States__:
- break;
+ case Thread::Blocked:
+ return "Blocked";
}
kprintf("to_string(Thread::State): Invalid state: %u\n", state);
ASSERT_NOT_REACHED();
diff --git a/Kernel/Thread.h b/Kernel/Thread.h
index b2597002f0..f6d7237d53 100644
--- a/Kernel/Thread.h
+++ b/Kernel/Thread.h
@@ -63,10 +63,7 @@ public:
Dying,
Dead,
Stopped,
-
- __Begin_Blocked_States__,
- BlockedCondition,
- __End_Blocked_States__
+ Blocked,
};
class Blocker {
@@ -176,7 +173,7 @@ public:
bool is_stopped() const { return m_state == Stopped; }
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; }