summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
Diffstat (limited to 'rts')
-rw-r--r--rts/Schedule.c4
-rw-r--r--rts/Task.c16
2 files changed, 8 insertions, 12 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 77dcf411c7..c61e623a03 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -2578,7 +2578,6 @@ exitScheduler( void )
boundTaskExiting(task);
stopTaskManager();
}
- closeMutex(&sched_mutex);
#endif
}
@@ -2586,6 +2585,9 @@ void
freeScheduler( void )
{
freeTaskManager();
+#if defined(THREADED_RTS)
+ closeMutex(&sched_mutex);
+#endif
}
/* ---------------------------------------------------------------------------
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);
}