From 99c53776530d3831d0e280e5733e96f971f46c96 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 19 Jul 2019 09:57:35 +0200 Subject: [PATCH] Kernel: Remove old block(State) API New API should be used always :) --- Kernel/Thread.cpp | 8 ++++---- Kernel/Thread.h | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index fab0c10dee0..2375c2c1794 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -111,16 +111,16 @@ void Thread::unblock() void Thread::block_until(const char* state_string, Function&& condition) { m_blocker = make(state_string, condition); - block(Thread::Blocked); + block_helper(); Scheduler::yield(); } -void Thread::block(Thread::State new_state) +void Thread::block_helper() { bool did_unlock = process().big_lock().unlock_if_locked(); ASSERT(state() == Thread::Running); m_was_interrupted_while_blocked = false; - set_state(new_state); + set_state(Thread::Blocked); Scheduler::yield(); if (did_unlock) process().big_lock().lock(); @@ -129,7 +129,7 @@ void Thread::block(Thread::State new_state) void Thread::block(Blocker& blocker) { m_blocker = &blocker; - block(Thread::Blocked); + block_helper(); } u64 Thread::sleep(u32 ticks) diff --git a/Kernel/Thread.h b/Kernel/Thread.h index a14e353fa94..7bed97d26fd 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -208,7 +208,6 @@ public: u32 ticks() const { return m_ticks; } u64 sleep(u32 ticks); - void block(Thread::State); void block(Blocker& blocker); void unblock(); @@ -299,6 +298,8 @@ private: State m_state { Invalid }; bool m_has_used_fpu { false }; bool m_was_interrupted_while_blocked { false }; + + void block_helper(); }; HashTable& thread_table();