summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-10-05 18:12:38 -0400
committerBen Gamari <ben@smart-cactus.org>2020-11-24 12:03:03 -0500
commit2e76a63116df473e720ab1d95e3aa159b2d2998f (patch)
tree762c759aec19c4882a5fab527d2be564dbbe26d1 /rts/Schedule.c
parent1bcc9cd05822587be768eff708ebdb50822ab2af (diff)
downloadhaskell-2e76a63116df473e720ab1d95e3aa159b2d2998f.tar.gz
Document schedulePushWork race
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index e7d60297f1..e542e4006a 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -843,14 +843,9 @@ schedulePushWork(Capability *cap USED_IF_THREADS,
appendToRunQueue(free_caps[i],t);
traceEventMigrateThread (cap, t, free_caps[i]->no);
+ // See Note [Benign data race due to work-pushing].
if (t->bound) {
- // N.B. we typically would need to hold 't->bound->task->lock' to change 'cap'
- // but this is safe because the Task lives on our run queue. See
- // Note [Ownership of Task].
- TSAN_ANNOTATE_HAPPENS_BEFORE(&t->bound->task->cap);
- // The happens-before matches the happens-after in
- // waitForWorkerCapability
- RELAXED_STORE(&t->bound->task->cap, free_caps[i]);
+ t->bound->task->cap = free_caps[i];
}
t->cap = free_caps[i];
n--; // we have one fewer threads now