1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:38:11 +00:00

Move runnable/non-runnable list control entirely over to Scheduler

This way, we can change how the scheduler works without having to change Thread too.
This commit is contained in:
Robin Burchell 2019-07-19 17:21:13 +02:00 committed by Andreas Kling
parent c1ed16c8e8
commit 342f7a6b0f
4 changed files with 102 additions and 75 deletions

View file

@ -16,9 +16,6 @@ HashTable<Thread*>& thread_table()
return *table;
}
Thread::SchedulerThreadList* Thread::g_runnable_threads;
Thread::SchedulerThreadList* Thread::g_nonrunnable_threads;
static const u32 default_kernel_stack_size = 65536;
static const u32 default_userspace_stack_size = 65536;
@ -75,7 +72,7 @@ Thread::Thread(Process& process)
if (m_process.pid() != 0) {
InterruptDisabler disabler;
thread_table().set(this);
g_nonrunnable_threads->append(*this);
Scheduler::init_thread(*this);
}
}
@ -514,8 +511,6 @@ Thread* Thread::clone(Process& process)
void Thread::initialize()
{
g_runnable_threads = new SchedulerThreadList;
g_nonrunnable_threads = new SchedulerThreadList;
Scheduler::initialize();
}
@ -545,15 +540,6 @@ void Thread::set_state(State new_state)
m_state = new_state;
if (m_process.pid() != 0) {
SchedulerThreadList* list = nullptr;
if (is_runnable_state(new_state))
list = g_runnable_threads;
else
list = g_nonrunnable_threads;
if (list->contains(*this))
return;
list->append(*this);
Scheduler::update_state_for_thread(*this);
}
}