diff options
author | Tom <tomut@yahoo.com> | 2021-01-27 22:29:17 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-28 08:14:12 +0100 |
commit | 8104abf640f66925f41d63d04052dbd03c3f76a7 (patch) | |
tree | d79063594b1a325b540a72d8fd7c54abd4efc9b3 /Kernel/Process.h | |
parent | 985ce3b7010e72bf8daa63b7c9e3ec8096dd900c (diff) | |
download | serenity-8104abf640f66925f41d63d04052dbd03c3f76a7.zip |
Kernel: Remove colonel special-case from Process::for_each_thread
Since each Process now has its own list of threads, we don't need
to treat colonel any different anymore. This also means that it
reports all kernel threads, not just the idle threads.
Diffstat (limited to 'Kernel/Process.h')
-rw-r--r-- | Kernel/Process.h | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h index 5b851ace20..ae43f88aea 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -700,22 +700,11 @@ inline void Process::for_each_child(Callback callback) template<typename Callback> inline IterationDecision Process::for_each_thread(Callback callback) const { - if (pid() == 0) { - // NOTE: Special case the colonel process, since its main thread is not in the global thread table. - Processor::for_each( - [&](Processor& proc) -> IterationDecision { - auto idle_thread = proc.idle_thread(); - if (idle_thread != nullptr) - return callback(*idle_thread); - return IterationDecision::Continue; - }); - } else { - ScopedSpinLock thread_list_lock(m_thread_list_lock); - for (auto& thread : m_thread_list) { - IterationDecision decision = callback(thread); - if (decision != IterationDecision::Continue) - return decision; - } + ScopedSpinLock thread_list_lock(m_thread_list_lock); + for (auto& thread : m_thread_list) { + IterationDecision decision = callback(thread); + if (decision != IterationDecision::Continue) + return decision; } return IterationDecision::Continue; } |