1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

move cleanup code to correct position (do_exit)

This commit is contained in:
Stefan Lankes 2015-07-13 06:49:46 +02:00
parent 71418322da
commit 8db1094ce4

View file

@ -160,7 +160,6 @@ void finish_task_switch(void)
task_t* old;
uint8_t prio;
const uint32_t core_id = CORE_ID;
task_t* curr_task = per_core(current_task);
spinlock_irqsave_lock(&readyqueues[core_id].lock);
@ -186,9 +185,6 @@ void finish_task_switch(void)
}
spinlock_irqsave_unlock(&readyqueues[core_id].lock);
if (curr_task->heap)
kfree(curr_task->heap);
}
/** @brief A procedure to be called by
@ -201,6 +197,10 @@ static void NORETURN do_exit(int arg)
kprintf("Terminate task: %u, return value %d\n", curr_task->id, arg);
page_map_drop();
if (curr_task->heap) {
kfree(curr_task->heap);
curr_task->heap = NULL;
}
// decrease the number of active tasks
spinlock_irqsave_lock(&readyqueues[core_id].lock);