Add GetThread() function to PCB class

This commit is contained in:
EnderIce2 2024-03-25 15:12:21 +02:00
parent 2274089a1c
commit ab8ca388bb
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 9 additions and 0 deletions

View File

@ -473,6 +473,7 @@ namespace Tasking
void SetWorkingDirectory(Node *node);
void SetExe(const char *path);
size_t GetSize();
TCB *GetThread(TID ID);
PCB(class Task *ctx,
PCB *Parent,

View File

@ -48,6 +48,14 @@ using namespace vfs;
namespace Tasking
{
TCB *PCB::GetThread(TID ID)
{
auto it = std::find_if(this->Threads.begin(), this->Threads.end(),
[ID](TCB *t)
{ return t->ID == ID; });
return it != this->Threads.end() ? *it : nullptr;
}
int PCB::SendSignal(int sig)
{
return this->Signals->SendSignal(sig);