summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-16 00:14:11 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-16 16:12:45 -0500
commit287fa3fbcc1db460490d45662c3c62fdee7bd6d6 (patch)
treeb8fa7ad8acc2fdda4348d98ae317856fc7b06003
parenta3eccf06292dd666b24606251a52da2b466a9612 (diff)
downloadhaskell-287fa3fbcc1db460490d45662c3c62fdee7bd6d6.tar.gz
rts: Ensure that all accesses to pending_sync are atomic
-rw-r--r--rts/Schedule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 54fc976a44..8afcf54ca0 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -1430,7 +1430,7 @@ void stopAllCapabilitiesWith (Capability **pCap, Task *task, SyncType sync_type)
acquireAllCapabilities(pCap ? *pCap : NULL, task);
- pending_sync = 0;
+ RELAXED_STORE(&pending_sync, 0);
signalCondition(&sync_finished_cond);
}
#endif
@@ -1876,7 +1876,7 @@ delete_threads_and_gc:
#if defined(THREADED_RTS)
// reset pending_sync *before* GC, so that when the GC threads
// emerge they don't immediately re-enter the GC.
- pending_sync = 0;
+ RELAXED_STORE(&pending_sync, 0);
signalCondition(&sync_finished_cond);
GarbageCollect(collect_gen, heap_census, is_overflow_gc, deadlock_detect, gc_type, cap, idle_cap);
#else