mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
Kernel: Add a Thread::all_threads() helper.
This commit is contained in:
parent
e561ab1b0b
commit
fa7f532c35
2 changed files with 11 additions and 0 deletions
|
@ -522,3 +522,12 @@ void Thread::initialize()
|
||||||
g_threads = new InlineLinkedList<Thread>;
|
g_threads = new InlineLinkedList<Thread>;
|
||||||
Scheduler::initialize();
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@ public:
|
||||||
static void initialize();
|
static void initialize();
|
||||||
static void finalize_dying_threads();
|
static void finalize_dying_threads();
|
||||||
|
|
||||||
|
static Vector<Thread*> all_threads();
|
||||||
|
|
||||||
int tid() const { return m_tid; }
|
int tid() const { return m_tid; }
|
||||||
int pid() const;
|
int pid() const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue