Explorar el Código

Kernel: Disable interrupts in Thread::set_state().

We don't want to get interrupted while we're manipulating the thread lists.
Andreas Kling hace 6 años
padre
commit
e7ce4514ec
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2 0
      Kernel/Thread.cpp

+ 2 - 0
Kernel/Thread.cpp

@@ -568,6 +568,7 @@ bool Thread::is_thread(void* ptr)
 
 
 void Thread::set_thread_list(InlineLinkedList<Thread>* thread_list)
 void Thread::set_thread_list(InlineLinkedList<Thread>* thread_list)
 {
 {
+    ASSERT_INTERRUPTS_DISABLED();
     ASSERT(pid() != 0);
     ASSERT(pid() != 0);
     if (m_thread_list == thread_list)
     if (m_thread_list == thread_list)
         return;
         return;
@@ -580,6 +581,7 @@ void Thread::set_thread_list(InlineLinkedList<Thread>* thread_list)
 
 
 void Thread::set_state(State new_state)
 void Thread::set_state(State new_state)
 {
 {
+    InterruptDisabler disabler;
     m_state = new_state;
     m_state = new_state;
     if (m_process.pid() != 0)
     if (m_process.pid() != 0)
         set_thread_list(thread_list_for_state(new_state));
         set_thread_list(thread_list_for_state(new_state));