Sfoglia il codice sorgente

Kernel: Let the wait blocker inspect *all* child threads of a process

Previously would only grab the first thread in the thread list that
had the same PID as our waitee and check if it was stopped.
Andreas Kling 5 anni fa
parent
commit
24d5855428
1 ha cambiato i file con 7 aggiunte e 3 eliminazioni
  1. 7 3
      Kernel/Scheduler.cpp

+ 7 - 3
Kernel/Scheduler.cpp

@@ -264,9 +264,13 @@ bool Thread::WaitBlocker::should_unblock(Thread& thread, time_t, long)
         bool child_exited = child.is_dead();
         bool child_exited = child.is_dead();
         bool child_stopped = false;
         bool child_stopped = false;
         if (child.thread_count()) {
         if (child.thread_count()) {
-            auto& child_thread = child.any_thread();
-            if (child_thread.state() == Thread::State::Stopped && !child_thread.has_pending_signal(SIGCONT))
-                child_stopped = true;
+            child.for_each_thread([&](auto& child_thread) {
+                if (child_thread.state() == Thread::State::Stopped && !child_thread.has_pending_signal(SIGCONT)) {
+                    child_stopped = true;
+                    return IterationDecision::Break;
+                }
+                return IterationDecision::Continue;
+            });
         }
         }
 
 
         bool wait_finished = ((m_wait_options & WEXITED) && child_exited)
         bool wait_finished = ((m_wait_options & WEXITED) && child_exited)