summaryrefslogtreecommitdiff
path: root/rts/Task.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-03-11 09:36:32 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-03-11 09:36:32 +0000
commit12cfec943127f0c81e1ffa1ca5ce46e888e3027c (patch)
treea063a45d986479a08f213559c221d78774b49b73 /rts/Task.c
parentce7bf1839d868fd829f0224b226da54612ac0e88 (diff)
downloadhaskell-12cfec943127f0c81e1ffa1ca5ce46e888e3027c.tar.gz
fix bug in discardTasksExcept() that broke forkProcess
Diffstat (limited to 'rts/Task.c')
-rw-r--r--rts/Task.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rts/Task.c b/rts/Task.c
index 2921e9e181..e2f363b321 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);