diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-09-27 18:24:15 +0000 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-10-24 21:00:36 -0400 |
commit | 2e9ba3f2881a59fde9932929dce7c42cdcfd4432 (patch) | |
tree | 12b58f125f269b06b62e7145e2640cdf9682f2f7 /rts | |
parent | 6517a2ea285688907e8d71e8313f04e919a24445 (diff) | |
download | haskell-2e9ba3f2881a59fde9932929dce7c42cdcfd4432.tar.gz |
rts/Capability: Use relaxed operations for last_free_capability
Diffstat (limited to 'rts')
-rw-r--r-- | rts/Capability.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rts/Capability.c b/rts/Capability.c index f13d076ca5..384d93c27e 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -591,7 +591,7 @@ releaseCapability_ (Capability* cap, #if defined(PROFILING) cap->r.rCCCS = CCS_IDLE; #endif - last_free_capability[cap->node] = cap; + RELAXED_STORE(&last_free_capability[cap->node], cap); debugTrace(DEBUG_sched, "freeing capability %d", cap->no); } @@ -784,7 +784,7 @@ static Capability * find_capability_for_task(const Task * task) enabled_capabilities]; } else { // Try last_free_capability first - Capability *cap = last_free_capability[task->node]; + Capability *cap = RELAXED_LOAD(&last_free_capability[task->node]); // N.B. There is a data race here since we are loking at // cap->running_task without taking cap->lock. However, this is @@ -804,7 +804,7 @@ static Capability * find_capability_for_task(const Task * task) } // Can't find a free one, use last_free_capability. - return last_free_capability[task->node]; + return RELAXED_LOAD(&last_free_capability[task->node]); } } } |