mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Fixes for Tasking
This commit is contained in:
parent
55f63d26fa
commit
1c1b4249f6
@ -379,12 +379,20 @@ namespace Tasking
|
||||
{
|
||||
SmartCriticalSection(TaskingLock);
|
||||
TCB *Thread = new TCB;
|
||||
Thread->ID = this->NextTID++;
|
||||
strcpy(Thread->Name, Parent->Name);
|
||||
if (Parent == nullptr)
|
||||
Thread->Parent = this->GetCurrentProcess();
|
||||
else
|
||||
Thread->Parent = Parent;
|
||||
|
||||
if (!Parent)
|
||||
{
|
||||
error("Parent is null");
|
||||
delete Thread;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Thread->ID = this->NextTID++;
|
||||
strcpy(Thread->Name, Parent->Name);
|
||||
Thread->EntryPoint = EntryPoint;
|
||||
Thread->Offset = Offset;
|
||||
Thread->ExitCode = 0xdeadbeef;
|
||||
@ -445,6 +453,7 @@ namespace Tasking
|
||||
{
|
||||
error("Unknown elevation.");
|
||||
KernelAllocator.FreePages((void *)((uint64_t)Thread->Stack - STACK_SIZE), TO_PAGES(STACK_SIZE));
|
||||
this->NextTID--;
|
||||
delete Thread;
|
||||
return nullptr;
|
||||
}
|
||||
@ -533,6 +542,7 @@ namespace Tasking
|
||||
default:
|
||||
{
|
||||
error("Unknown elevation.");
|
||||
this->NextPID--;
|
||||
delete Process;
|
||||
return nullptr;
|
||||
}
|
||||
@ -556,8 +566,9 @@ namespace Tasking
|
||||
}
|
||||
Process->Info.Priority = 0;
|
||||
|
||||
debug("Created process %d(%s) in process %d(%s)", Process->ID, Process->Name, Process->Parent->ID, Process->Parent->Name);
|
||||
debug("Created process %d(%s) in process %d(%s)", Process->ID, Process->Name, Parent ? Process->Parent->ID : 0, Parent ? Process->Parent->Name : "None");
|
||||
|
||||
if (Parent)
|
||||
Parent->Children.push_back(Process);
|
||||
ListProcess.push_back(Process);
|
||||
return Process;
|
||||
|
Loading…
x
Reference in New Issue
Block a user