mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
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.
This commit is contained in:
parent
f88a8b16d7
commit
21d288a10e
5 changed files with 45 additions and 29 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue