Kernel: Add a Thread::all_threads() helper.

This commit is contained in:
Andreas Kling 2019-03-23 23:50:34 +01:00
commit fa7f532c35
Notes: sideshowbarker 2024-07-19 14:57:46 +09:00
2 changed files with 11 additions and 0 deletions

View file

@ -522,3 +522,12 @@ void Thread::initialize()
g_threads = new InlineLinkedList<Thread>;
Scheduler::initialize();
}
Vector<Thread*> Thread::all_threads()
{
Vector<Thread*> threads;
InterruptDisabler disabler;
for (auto* thread = g_threads->head(); thread; thread = thread->next())
threads.append(thread);
return threads;
}