summaryrefslogtreecommitdiff
path: root/rts/Task.c
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2006-12-12 15:33:53 +0000
committerSimon Marlow <simonmar@microsoft.com>2006-12-12 15:33:53 +0000
commit6ffb1cec5bc6fcc834547fc456322d2eb2418ff6 (patch)
tree08aa52cd1a785a47a321a6fe1a707dc0c7ecf752 /rts/Task.c
parent55476c33f7389b8d0d8def117b3b2c5833663a79 (diff)
downloadhaskell-6ffb1cec5bc6fcc834547fc456322d2eb2418ff6.tar.gz
Don't free sched_mutex until freeTaskManager has finished with it
Also move closeMutex() etc. into freeTaskManager, this is a free-ish thing
Diffstat (limited to 'rts/Task.c')
-rw-r--r--rts/Task.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/rts/Task.c b/rts/Task.c
index 0e51dbf124..551f13777a 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -68,20 +68,10 @@ initTaskManager (void)
void
stopTaskManager (void)
{
- Task *task;
-
debugTrace(DEBUG_sched,
"stopping task manager, %d tasks still running",
tasksRunning);
-
- ACQUIRE_LOCK(&sched_mutex);
- for (task = task_free_list; task != NULL; task = task->next) {
-#if defined(THREADED_RTS)
- closeCondition(&task->cond);
- closeMutex(&task->lock);
-#endif
- }
- RELEASE_LOCK(&sched_mutex);
+ /* nothing to do */
}
@@ -94,6 +84,10 @@ freeTaskManager (void)
ACQUIRE_LOCK(&sched_mutex);
for (task = task_free_list; task != NULL; task = next) {
+#if defined(THREADED_RTS)
+ closeCondition(&task->cond);
+ closeMutex(&task->lock);
+#endif
next = task->next;
stgFree(task);
}