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

Kernel: Various context switch fixes

These changes solve a number of problems with the software
context swithcing:

* The scheduler lock really should be held throughout context switches
* Transitioning from the initial (idle) thread to another needs to
  hold the scheduler lock
* Transitioning from a dying thread to another also needs to hold
  the scheduler lock
* Dying threads cannot necessarily be finalized if they haven't
  switched out of it yet, so flag them as active while a processor
  is running it (the Running state may be switched to Dying while
  it still is actually running)
This commit is contained in:
Tom 2020-07-05 14:32:07 -06:00 committed by Andreas Kling
parent 49f5069b76
commit 2a82a25fec
9 changed files with 235 additions and 89 deletions

View file

@ -58,11 +58,13 @@ public:
static timeval time_since_boot();
static bool yield();
static bool donate_to(Thread*, const char* reason);
static bool context_switch(Thread&);
static bool context_switch(Thread*);
static void enter_current(Thread& prev_thread);
static Process* colonel();
static void beep();
static void idle_loop();
static void invoke_async();
static void notify_finalizer();
template<typename Callback>
static inline IterationDecision for_each_runnable(Callback);