summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-10-28 10:21:10 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-29 03:53:52 -0400
commit22f5d9a951dbc9cfdf55984c5e2a6fad28a6f650 (patch)
treef247a12ebddc26086f5c95cef5e4ad7a2ca6efcf
parent0e9f6defbdc1f691ff7197b21e68ac16ffa4ab59 (diff)
downloadhaskell-22f5d9a951dbc9cfdf55984c5e2a6fad28a6f650.tar.gz
GC: Avoid data race (#18717, #17964)
-rw-r--r--rts/sm/GC.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index 0fa927f2ad..c39dcc2e89 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -1257,10 +1257,10 @@ gcWorkerThread (Capability *cap)
// Wait until we're told to continue
RELEASE_SPIN_LOCK(&gct->gc_spin);
+ stat_endGCWorker (cap, gct); // write stats before setting gct->wakeup (#17964,#18717)
gct->wakeup = GC_THREAD_WAITING_TO_CONTINUE;
debugTrace(DEBUG_gc, "GC thread %d waiting to continue...",
gct->thread_index);
- stat_endGCWorker (cap, gct);
ACQUIRE_SPIN_LOCK(&gct->mut_spin);
debugTrace(DEBUG_gc, "GC thread %d on my way...", gct->thread_index);