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/Thread.h | |
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/Thread.h')
-rw-r--r-- | Kernel/Thread.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Thread.h b/Kernel/Thread.h index 4208f245fd..31d6a39f5f 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -87,7 +87,7 @@ class Thread public: inline static Thread* current() { - return Processor::current().current_thread(); + return Processor::current_thread(); } explicit Thread(NonnullRefPtr<Process>); |