summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-14 19:46:31 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-16 16:12:45 -0500
commit1cf13bd0c7cbfc97fe0ec86e6860992dc6e849a5 (patch)
tree86be97bac41e966509655295a484e809fbf1a68b
parent7ca683e44f9f7a9a7984bbed4f49712838638fc8 (diff)
downloadhaskell-1cf13bd0c7cbfc97fe0ec86e6860992dc6e849a5.tar.gz
PrimOps: Fix benign MutVar race
Relaxed ordering is fine here since the later CAS implies a release.
-rw-r--r--rts/PrimOps.cmm4
1 files changed, 2 insertions, 2 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index d764801c83..96fd969e93 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -776,7 +776,7 @@ stg_atomicModifyMutVar2zh ( gcptr mv, gcptr f )
StgThunk_payload(y,0) = z;
retry:
- x = StgMutVar_var(mv);
+ x = %relaxed StgMutVar_var(mv);
StgThunk_payload(z,1) = x;
#if defined(THREADED_RTS)
(h) = prim %cmpxchgW(mv + SIZEOF_StgHeader + OFFSET_StgMutVar_var, x, y);
@@ -829,7 +829,7 @@ stg_atomicModifyMutVarzuzh ( gcptr mv, gcptr f )
StgThunk_payload(z,0) = f;
retry:
- x = StgMutVar_var(mv);
+ x = %relaxed StgMutVar_var(mv);
StgThunk_payload(z,1) = x;
#if defined(THREADED_RTS)
(h) = prim %cmpxchgW(mv + SIZEOF_StgHeader + OFFSET_StgMutVar_var, x, z);