summaryrefslogtreecommitdiff
path: root/Kernel/Task.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Task.cpp')
-rw-r--r--Kernel/Task.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Kernel/Task.cpp b/Kernel/Task.cpp
index 581345a669..e46985ee4b 100644
--- a/Kernel/Task.cpp
+++ b/Kernel/Task.cpp
@@ -235,6 +235,26 @@ void Task::dumpRegions()
}
}
+void Task::sys$exit(int status)
+{
+ cli();
+ kprintf("sys$exit: %s(%u) exit with status %d\n", name().characters(), pid(), status);
+
+ setState(Exiting);
+ dumpRegions();
+
+ s_tasks->remove(this);
+
+ if (!scheduleNewTask()) {
+ kprintf("Task::taskDidCrash: Failed to schedule a new task :(\n");
+ HANG;
+ }
+
+ delete this;
+
+ switchNow();
+}
+
void Task::taskDidCrash(Task* crashedTask)
{
// NOTE: This is called from an excepton handler, so interrupts are disabled.