1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:37:46 +00:00

Kernel: Retire SchedulerData and add Thread lookup table

This allows us to get rid of the thread lists in SchedulerData.
Also, instead of iterating over all threads to find a thread by id,
just use a lookup table. In the rare case of having to iterate over
all threads, just iterate the lookup table.
This commit is contained in:
Tom 2021-01-27 22:58:24 -07:00 committed by Andreas Kling
parent e55d227f93
commit d5472426ec
5 changed files with 57 additions and 153 deletions

View file

@ -40,12 +40,10 @@ class Process;
class Thread;
class WaitQueue;
struct RegisterState;
struct SchedulerData;
extern Thread* g_finalizer;
extern WaitQueue* g_finalizer_wait_queue;
extern Atomic<bool> g_finalizer_has_work;
extern SchedulerData* g_scheduler_data;
extern RecursiveSpinLock g_scheduler_lock;
class Scheduler {
@ -73,14 +71,6 @@ public:
static Thread& pull_next_runnable_thread();
static bool dequeue_runnable_thread(Thread&, bool = false);
static void queue_runnable_thread(Thread&);
template<typename Callback>
static inline IterationDecision for_each_runnable(Callback);
template<typename Callback>
static inline IterationDecision for_each_nonrunnable(Callback);
static void init_thread(Thread& thread);
};
}