Преглед на файлове

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 преди 5 години
родител
ревизия
523fd6533e
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      Kernel/Thread.cpp

+ 3 - 0
Kernel/Thread.cpp

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