mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
Kernel: Process::for_each_thread() should show the main thread of PID 0
This commit is contained in:
parent
fe0aa2ca53
commit
86a9a52355
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue