X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=rts%2FTask.c;h=e2f363b3210d83fc9e6220b7a2a09fd4e9a89947;hb=373978e7d6db47f318555397753b1d41064b1750;hp=2921e9e18137732e56f626bc83d08ca1cbd982d0;hpb=7effbbbbdfe7eb05c6402fa9337e358e7e9fadde;p=ghc-hetmet.git diff --git a/rts/Task.c b/rts/Task.c index 2921e9e..e2f363b 100644 --- a/rts/Task.c +++ b/rts/Task.c @@ -280,11 +280,12 @@ 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);