1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +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

@ -2,6 +2,8 @@
#include <AK/Assertions.h>
#include <AK/Types.h>
#include <AK/Function.h>
#include <AK/IntrusiveList.h>
class Process;
class Thread;
@ -27,6 +29,29 @@ public:
static bool is_active();
static void beep();
template<typename Callback>
static inline IterationDecision for_each_runnable(Callback callback)
{
return for_each_runnable_func([callback](Thread& thread) {
return callback(thread);
});
}
template<typename Callback>
static inline IterationDecision for_each_nonrunnable(Callback callback)
{
return for_each_nonrunnable_func([callback](Thread& thread) {
return callback(thread);
});
}
static void init_thread(Thread& thread);
static void update_state_for_thread(Thread& thread);
private:
static void prepare_for_iret_to_new_process();
static IterationDecision for_each_runnable_func(Function<IterationDecision(Thread&)>&& callback);
static IterationDecision for_each_nonrunnable_func(Function<IterationDecision(Thread&)>&& callback);
};