summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-16 00:14:24 -0500
committerMatthew Pickering <matthewtpickering@gmail.com>2023-01-06 15:21:48 +0000
commit403171356f3a659cc57aae3c3e3f4b52c88a6dd9 (patch)
tree3a920cecc6bac2e850f64e507385d9b52f1a5fd0 /rts
parentd6eb8ba10fdbcd1636b9c6288feab6161ccb46c2 (diff)
downloadhaskell-403171356f3a659cc57aae3c3e3f4b52c88a6dd9.tar.gz
nonmoving: Ensure that we aren't holding locks when closing them
TSAN complains about this sort of thing. (cherry picked from commit c99367180e49d903f8be649bfdc11e95649c7d1a)
Diffstat (limited to 'rts')
-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);