Commit 6ffb1cec authored by Simon Marlow's avatar Simon Marlow
Browse files

Don't free sched_mutex until freeTaskManager has finished with it

Also move closeMutex() etc. into freeTaskManager, this is a free-ish thing
parent 55476c33
......@@ -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
}
/* ---------------------------------------------------------------------------
......
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment