소스 검색

Kernel: Make sure we never put the colonel thread in the runnable list.

This would cause it to get scheduled unnecessarily.
Andreas Kling 6 년 전
부모
커밋
7900da9667
2개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 0
      Kernel/Scheduler.cpp
  2. 3 1
      Kernel/Thread.cpp

+ 3 - 0
Kernel/Scheduler.cpp

@@ -232,6 +232,9 @@ bool Scheduler::pick_next()
     }
 #endif
 
+    if (g_runnable_threads->is_empty())
+        return context_switch(s_colonel_process->main_thread());
+
     auto* previous_head = g_runnable_threads->head();
     for (;;) {
         // Move head to tail.

+ 3 - 1
Kernel/Thread.cpp

@@ -546,6 +546,7 @@ bool Thread::is_thread(void* ptr)
 
 void Thread::set_thread_list(InlineLinkedList<Thread>* thread_list)
 {
+    ASSERT(pid() != 0);
     if (m_thread_list == thread_list)
         return;
     if (m_thread_list)
@@ -558,5 +559,6 @@ void Thread::set_thread_list(InlineLinkedList<Thread>* thread_list)
 void Thread::set_state(State new_state)
 {
     m_state = new_state;
-    set_thread_list(thread_list_for_state(new_state));
+    if (m_process.pid() != 0)
+        set_thread_list(thread_list_for_state(new_state));
 }