X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FTask.c;h=98f083c11257ff51f4f6c581b2a45ff1d5611154;hb=497f8aa6c2c8770daf3d39f57ee5e04dcdcc3778;hp=2921e9e18137732e56f626bc83d08ca1cbd982d0;hpb=7effbbbbdfe7eb05c6402fa9337e358e7e9fadde;p=ghc-hetmet.git diff --git a/rts/Task.c b/rts/Task.c index 2921e9e..98f083c 100644 --- a/rts/Task.c +++ b/rts/Task.c @@ -153,6 +153,7 @@ newTask (rtsBool worker) task->cap = NULL; task->worker = worker; task->stopped = rtsFalse; + task->running_finalizers = rtsFalse; task->stat = NoStatus; task->ret = NULL; task->n_spare_incalls = 0; @@ -280,17 +281,19 @@ boundTaskExiting (Task *task) void discardTasksExcept (Task *keep) { - Task *task; + Task *task, *next; // Wipe the task list, except the current Task. ACQUIRE_LOCK(&sched_mutex); - for (task = all_tasks; task != NULL; task=task->all_link) { + for (task = all_tasks; task != NULL; task=next) { + next = task->all_link; if (task != keep) { debugTrace(DEBUG_sched, "discarding task %ld", (long)TASK_ID(task)); freeTask(task); } } all_tasks = keep; + keep->all_link = NULL; RELEASE_LOCK(&sched_mutex); }