summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-16 00:14:24 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-23 19:09:30 -0500
commitc99367180e49d903f8be649bfdc11e95649c7d1a (patch)
tree40ba8ddf4908c3652355f0db7d530d01c27da053
parent543cae0084a72ca767a443d857f9e65a5a79f71d (diff)
downloadhaskell-c99367180e49d903f8be649bfdc11e95649c7d1a.tar.gz
nonmoving: Ensure that we aren't holding locks when closing them
TSAN complains about this sort of thing.
-rw-r--r--rts/sm/NonMoving.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c
index 541dfe85c5..72bfdbafa7 100644
--- a/rts/sm/NonMoving.c
+++ b/rts/sm/NonMoving.c
@@ -753,7 +753,7 @@ void nonmovingStop(void)
"waiting for nonmoving collector thread to terminate");
ACQUIRE_LOCK(&concurrent_coll_finished_lock);
waitCondition(&concurrent_coll_finished, &concurrent_coll_finished_lock);
- ACQUIRE_LOCK(&nonmoving_collection_mutex);
+ RELEASE_LOCK(&concurrent_coll_finished_lock);
}
#endif
}
@@ -766,6 +766,9 @@ void nonmovingExit(void)
nonmovingStop();
#if defined(THREADED_RTS)
+ ACQUIRE_LOCK(&nonmoving_collection_mutex);
+ RELEASE_LOCK(&nonmoving_collection_mutex);
+
closeMutex(&concurrent_coll_finished_lock);
closeCondition(&concurrent_coll_finished);
closeMutex(&nonmoving_collection_mutex);