diff --git a/kernel/src/thread/Scheduler.cpp b/kernel/src/thread/Scheduler.cpp index 6d6d88db..35cb458d 100644 --- a/kernel/src/thread/Scheduler.cpp +++ b/kernel/src/thread/Scheduler.cpp @@ -409,6 +409,16 @@ namespace Scheduler return {}; } + Option 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 result { false }; diff --git a/kernel/src/thread/Scheduler.h b/kernel/src/thread/Scheduler.h index a7244947..7021917a 100644 --- a/kernel/src/thread/Scheduler.h +++ b/kernel/src/thread/Scheduler.h @@ -38,6 +38,7 @@ namespace Scheduler LinkedList check_for_dead_processes(); Option find_by_pid(pid_t pid); + Option find_by_tid(pid_t tid); template void for_each_child(Process* process, Callback callback) {