mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-20 17:29:21 +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
Notes:
sideshowbarker
2024-07-18 22:49:12 +09:00
Author: https://github.com/tomuta
Commit: 21d288a10e
Pull-request: https://github.com/SerenityOS/serenity/pull/5100
Reviewed-by: https://github.com/awesomekling
5 changed files with 45 additions and 29 deletions
|
@ -87,7 +87,7 @@ class Thread
|
|||
public:
|
||||
inline static Thread* current()
|
||||
{
|
||||
return Processor::current().current_thread();
|
||||
return Processor::current_thread();
|
||||
}
|
||||
|
||||
explicit Thread(NonnullRefPtr<Process>);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue