1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

Actually destroy tasks after they crash.

This commit is contained in:
Andreas Kling 2018-10-18 00:26:30 +02:00
parent 1a801e5737
commit 9d5de91cf3
3 changed files with 20 additions and 7 deletions

View file

@ -169,10 +169,26 @@ Task::Task(void (*e)(), const char* n, IPC::Handle h, RingLevel ring)
Task::~Task()
{
system.nprocess--;
delete [] m_ldtEntries;
m_ldtEntries = nullptr;
}
void Task::taskDidCrash(Task* crashedTask)
{
crashedTask->setState(Crashing);
s_tasks->remove(crashedTask);
if (!scheduleNewTask()) {
kprintf("Task::taskDidCrash: Failed to schedule a new task :(\n");
HANG;
}
delete crashedTask;
switchNow();
}
void yield()
{
if (!current) {