diff options
author | Tom <tomut@yahoo.com> | 2021-01-26 14:16:07 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-27 21:12:24 +0100 |
commit | 21d288a10e5a1a44e8852b70dd3bdfb619483180 (patch) | |
tree | 4f9329b50ba4cd625305296c5686bc9d0c787d74 /Kernel/Scheduler.cpp | |
parent | f88a8b16d7391ccdb828f659e40b892fe8fdbc83 (diff) | |
download | serenity-21d288a10e5a1a44e8852b70dd3bdfb619483180.zip |
Kernel: Make Thread::current smp-safe
Change Thread::current to be a static function and read using the fs
register, which eliminates a window between Processor::current()
returning and calling a function on it, which can trigger preemption
and a move to a different processor, which then causes operating
on the wrong object.
Diffstat (limited to 'Kernel/Scheduler.cpp')
-rw-r--r-- | Kernel/Scheduler.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 1d29ffb5fc..36b802ac62 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -483,7 +483,7 @@ void Scheduler::timer_tick(const RegisterState& regs) ASSERT_INTERRUPTS_DISABLED(); ASSERT(Processor::current().in_irq()); - auto current_thread = Processor::current().current_thread(); + auto current_thread = Processor::current_thread(); if (!current_thread) return; |