mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
Kernel: Process::for_each_thread() should show the main thread of PID 0
This commit is contained in:
parent
fe0aa2ca53
commit
86a9a52355
Notes:
sideshowbarker
2024-07-19 11:03:15 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/86a9a523559
|
@ -461,6 +461,13 @@ inline void Process::for_each_thread(Callback callback) const
|
|||
{
|
||||
InterruptDisabler disabler;
|
||||
pid_t my_pid = pid();
|
||||
|
||||
if (my_pid == 0) {
|
||||
// NOTE: Special case the colonel thread, since its main thread is not in the global thread table.
|
||||
callback(const_cast<Thread&>(main_thread()));
|
||||
return;
|
||||
}
|
||||
|
||||
Thread::for_each([callback, my_pid](Thread& thread) -> IterationDecision {
|
||||
if (thread.pid() == my_pid)
|
||||
return callback(thread);
|
||||
|
|
Loading…
Reference in a new issue