summaryrefslogtreecommitdiff
path: root/rts/Capability.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-09-27 18:52:15 +0000
committerBen Gamari <ben@smart-cactus.org>2020-10-24 21:00:37 -0400
commit8d2b3c3d1fcb9009b6dfcce85777e04bcec9d219 (patch)
tree21abdb46f64f1608d983a89dd7643d2431513212 /rts/Capability.c
parent811f915db3b682f33aad2c3e6ca039a6e8451c69 (diff)
downloadhaskell-8d2b3c3d1fcb9009b6dfcce85777e04bcec9d219.tar.gz
rts: Eliminate data races on pending_sync
Diffstat (limited to 'rts/Capability.c')
-rw-r--r--rts/Capability.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rts/Capability.c b/rts/Capability.c
index 0b5f009800..5ebe6c8b46 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -544,7 +544,7 @@ releaseCapability_ (Capability* cap,
// be currently in waitForCapability() waiting for this
// capability, in which case simply setting it as free would not
// wake up the waiting task.
- PendingSync *sync = pending_sync;
+ PendingSync *sync = SEQ_CST_LOAD(&pending_sync);
if (sync && (sync->type != SYNC_GC_PAR || sync->idle[cap->no])) {
debugTrace(DEBUG_sched, "sync pending, freeing capability %d", cap->no);
return;
@@ -906,7 +906,7 @@ yieldCapability (Capability** pCap, Task *task, bool gcAllowed)
if (gcAllowed)
{
- PendingSync *sync = pending_sync;
+ PendingSync *sync = SEQ_CST_LOAD(&pending_sync);
if (sync) {
switch (sync->type) {