Kernel: Remove old block(State) API

New API should be used always :)
This commit is contained in:
Robin Burchell 2019-07-19 09:57:35 +02:00 committed by Andreas Kling
parent 762333ba95
commit 99c5377653
Notes: sideshowbarker 2024-07-19 13:09:19 +09:00
2 changed files with 6 additions and 5 deletions

View File

@ -111,16 +111,16 @@ void Thread::unblock()
void Thread::block_until(const char* state_string, Function<bool()>&& condition)
{
m_blocker = make<ConditionBlocker>(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)

View File

@ -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*>& thread_table();