diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-01-01 20:53:23 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-01-09 21:21:37 -0500 |
commit | 3d15d8d008307a19314c23eeb65b8ead448f0b37 (patch) | |
tree | 6ba5e4fe15b966e61075b7cf92e944ffe0833c67 /rts | |
parent | 06beed685a69ed044159707363a791fd266f069b (diff) | |
download | haskell-3d15d8d008307a19314c23eeb65b8ead448f0b37.tar.gz |
rts: Use relaxed load when checking for cap ownership
This check is merely a service to the user; no reason to synchronize.
Diffstat (limited to 'rts')
-rw-r--r-- | rts/RtsAPI.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rts/RtsAPI.c b/rts/RtsAPI.c index aaea838f72..841d0419ab 100644 --- a/rts/RtsAPI.c +++ b/rts/RtsAPI.c @@ -720,7 +720,10 @@ PauseToken *rts_pause (void) // other capabilities. Doing this check is justified because rts_pause is a // user facing function and we want good error reporting. We also don't // expect rts_pause to be performance critical. - if (task->cap && task->cap->running_task == task) + // + // N.B. we use a relaxed load since there is no easy way to synchronize + // here and this check is ultimately just a convenience for the user.. + if (task->cap && RELAXED_LOAD(&task->cap->running_task) == task) { // This task owns a capability (and it can't be taken by other capabilities). errorBelch(task->cap->in_haskell |