Ver Fonte

Kernel: Unlock the Process when exit()ing

If there are more threads in a process when exit()ing, we need to give
them a chance to unwind any kernel stacks. This means we have to unlock
the process lock before giving control to the scheduler.

Fixes #891 (together with all of the other "no more main thread" work.)
Andreas Kling há 5 anos atrás
pai
commit
523fd6533e
1 ficheiros alterados com 3 adições e 0 exclusões
  1. 3 0
      Kernel/Thread.cpp

+ 3 - 0
Kernel/Thread.cpp

@@ -178,8 +178,11 @@ void Thread::die_if_needed()
     if (!m_should_die)
         return;
 
+    m_process.big_lock().unlock_if_locked();
+
     InterruptDisabler disabler;
     set_state(Thread::State::Dying);
+
     if (!Scheduler::is_active())
         Scheduler::pick_next_and_switch_now();
 }