kernel: Add a way to lookup specific threads
This commit is contained in:
parent
56a2b607b5
commit
2868fd8122
@ -409,6 +409,16 @@ namespace Scheduler
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Option<Thread*> find_by_tid(pid_t tid)
|
||||||
|
{
|
||||||
|
for (auto* const thread : g_threads)
|
||||||
|
{
|
||||||
|
if (thread->tid == tid) return thread;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
bool has_children(Process* process)
|
bool has_children(Process* process)
|
||||||
{
|
{
|
||||||
bool result { false };
|
bool result { false };
|
||||||
|
@ -38,6 +38,7 @@ namespace Scheduler
|
|||||||
LinkedList<Process> check_for_dead_processes();
|
LinkedList<Process> check_for_dead_processes();
|
||||||
|
|
||||||
Option<Process*> find_by_pid(pid_t pid);
|
Option<Process*> find_by_pid(pid_t pid);
|
||||||
|
Option<Thread*> find_by_tid(pid_t tid);
|
||||||
|
|
||||||
template <typename Callback> void for_each_child(Process* process, Callback callback)
|
template <typename Callback> void for_each_child(Process* process, Callback callback)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user