diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-12-06 14:40:49 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-01-27 23:56:43 -0500 |
commit | 55a81995b7da53afba0d630d0c1b99f8ae475cfa (patch) | |
tree | 6966cd4c7a37651393b49072dead071fcdd17e79 | |
parent | 8519af60805da653159833494efaac61add69fb1 (diff) | |
download | haskell-55a81995b7da53afba0d630d0c1b99f8ae475cfa.tar.gz |
rts: Fix non-atomic mutation of enabled_capabilities
-rw-r--r-- | rts/Schedule.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c index 8afcf54ca0..ba4e066ae5 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -2337,7 +2337,8 @@ setNumCapabilities (uint32_t new_n_capabilities USED_IF_THREADS) // update n_capabilities before things start running if (new_n_capabilities > n_capabilities) { - RELAXED_STORE(&n_capabilities, enabled_capabilities = new_n_capabilities); + RELAXED_STORE(&n_capabilities, new_n_capabilities); + RELAXED_STORE(&enabled_capabilities, new_n_capabilities); } // We're done: release the original Capabilities |