summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-16 00:14:24 -0500
committerBen Gamari <ben@smart-cactus.org>2023-04-12 07:42:54 -0400
commit96423b6900ef567a9353e19f99b6f70117a576f8 (patch)
treef5a34ca8cfe48c89a7b671144549e33458d2dc67
parent6df6dec3648684069f4a392a501d9defef8987ec (diff)
downloadhaskell-96423b6900ef567a9353e19f99b6f70117a576f8.tar.gz
nonmoving: Ensure that we aren't holding locks when closing them
TSAN complains about this sort of thing. (cherry picked from commit 71aea6d3160e1389c38bb94c281bd7c30a030147)
-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 fe8e89ed76..d5963658ed 100644
--- a/rts/sm/NonMoving.c
+++ b/rts/sm/NonMoving.c
@@ -754,7 +754,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
}
@@ -767,6 +767,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);