mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 21:52:07 +00:00
Kernel: Fix Lock race causing infinite spinning between two threads
We need to account for how many shared lock instances the current thread owns, so that we can properly release such references when yielding execution. We also need to release the process lock when donating.
This commit is contained in:
parent
56701f91f9
commit
c4176b0da1
10 changed files with 359 additions and 96 deletions
|
@ -348,7 +348,8 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
|||
ScopedSpinLock lock(g_scheduler_lock);
|
||||
new_main_thread->set_state(Thread::State::Runnable);
|
||||
}
|
||||
big_lock().force_unlock_if_locked();
|
||||
u32 lock_count_to_restore;
|
||||
(void)big_lock().force_unlock_if_locked(lock_count_to_restore);
|
||||
ASSERT_INTERRUPTS_DISABLED();
|
||||
ASSERT(Processor::current().in_critical());
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue