diff options
author | Tom <tomut@yahoo.com> | 2020-07-05 14:32:07 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-06 10:00:24 +0200 |
commit | 2a82a25fecd5342710410c8a89a9b949e6068ce8 (patch) | |
tree | c1183ec8bb57b5bca694132ac8368e7f12025192 /Kernel/Scheduler.h | |
parent | 49f5069b769958274c9ab0e653679ed8eb62a01f (diff) | |
download | serenity-2a82a25fecd5342710410c8a89a9b949e6068ce8.zip |
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)
Diffstat (limited to 'Kernel/Scheduler.h')
-rw-r--r-- | Kernel/Scheduler.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Kernel/Scheduler.h b/Kernel/Scheduler.h index bec0d27b89..5ffb57d201 100644 --- a/Kernel/Scheduler.h +++ b/Kernel/Scheduler.h @@ -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); |