From fec3bab822c13cf4fa1bc51170fd7ca1fe0d2111 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 16 Mar 2006 12:52:56 +0000 Subject: [PATCH] discardTask(): reset task->tso to avoid confusion later --- ghc/rts/Task.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ghc/rts/Task.c b/ghc/rts/Task.c index bc140c1..7621d8b 100644 --- a/ghc/rts/Task.c +++ b/ghc/rts/Task.c @@ -175,10 +175,15 @@ void discardTask (Task *task) { ASSERT_LOCK_HELD(&sched_mutex); - task->stopped = rtsTrue; - task->cap = NULL; - task->next = task_free_list; - task_free_list = task; + if (!task->stopped) { + IF_DEBUG(scheduler,sched_belch("discarding task %p",(void *)task->id)); + task->cap = NULL; + task->tso = NULL; + task->stopped = rtsTrue; + tasksRunning--; + task->next = task_free_list; + task_free_list = task; + } } void -- 1.7.10.4