Fixed memory accounting and task stack creation bugs.

This commit is contained in:
Eric Holk
2011-08-12 16:36:17 -07:00
parent 2f23405a60
commit b9f1f77622
7 changed files with 81 additions and 35 deletions

View File

@@ -108,8 +108,13 @@ struct spawn_args {
};
extern "C" CDECL
void task_exit(void *env, int rval, rust_task *task) {
void task_exit(intptr_t *env, int rval, rust_task *task) {
LOG(task, task, "task exited with value %d", rval);
if(env) {
// free the environment.
I(task->sched, 1 == *env); // the ref count better be 1
task->free(env);
}
task->die();
task->lock.lock();
task->notify_tasks_waiting_to_join();