mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
Kernel: Fix a few deadlocks with Thread::m_lock and g_scheduler_lock
g_scheduler_lock cannot safely be acquired after Thread::m_lock because another processor may already hold g_scheduler_lock and wait for the same Thread::m_lock.
This commit is contained in:
parent
8c764319ad
commit
1e2e3eed62
Notes:
sideshowbarker
2024-07-19 01:43:19 +09:00
Author: https://github.com/tomuta
Commit: 1e2e3eed62
Pull-request: https://github.com/SerenityOS/serenity/pull/3856
6 changed files with 55 additions and 37 deletions
|
@ -322,6 +322,7 @@ NonnullRefPtr<Process> Process::create_kernel_process(RefPtr<Thread>& first_thre
|
|||
process->ref();
|
||||
}
|
||||
|
||||
ScopedSpinLock lock(g_scheduler_lock);
|
||||
first_thread->set_affinity(affinity);
|
||||
first_thread->set_state(Thread::State::Runnable);
|
||||
return process;
|
||||
|
@ -781,6 +782,7 @@ RefPtr<Thread> Process::create_kernel_thread(void (*entry)(), u32 priority, cons
|
|||
auto& tss = thread->tss();
|
||||
tss.eip = (FlatPtr)entry;
|
||||
|
||||
ScopedSpinLock lock(g_scheduler_lock);
|
||||
thread->set_state(Thread::State::Runnable);
|
||||
return thread;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue