mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
Actually destroy tasks after they crash.
This commit is contained in:
parent
1a801e5737
commit
9d5de91cf3
3 changed files with 20 additions and 7 deletions
|
@ -169,10 +169,26 @@ Task::Task(void (*e)(), const char* n, IPC::Handle h, RingLevel ring)
|
||||||
|
|
||||||
Task::~Task()
|
Task::~Task()
|
||||||
{
|
{
|
||||||
|
system.nprocess--;
|
||||||
delete [] m_ldtEntries;
|
delete [] m_ldtEntries;
|
||||||
m_ldtEntries = nullptr;
|
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()
|
void yield()
|
||||||
{
|
{
|
||||||
if (!current) {
|
if (!current) {
|
||||||
|
|
|
@ -95,6 +95,8 @@ public:
|
||||||
static void initialize();
|
static void initialize();
|
||||||
void setError(int);
|
void setError(int);
|
||||||
|
|
||||||
|
static void taskDidCrash(Task*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FileHandle* openFile(String&&);
|
FileHandle* openFile(String&&);
|
||||||
|
|
||||||
|
|
|
@ -84,13 +84,8 @@ void exception_13_handler()
|
||||||
HANG;
|
HANG;
|
||||||
}
|
}
|
||||||
|
|
||||||
current->setState(Task::Crashing);
|
// NOTE: This will schedule a new task.
|
||||||
if (!scheduleNewTask()) {
|
Task::taskDidCrash(current);
|
||||||
kprintf("Failed to schedule a new task :(\n");
|
|
||||||
HANG;
|
|
||||||
}
|
|
||||||
|
|
||||||
switchNow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EH(i, msg) \
|
#define EH(i, msg) \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue