summaryrefslogtreecommitdiff
path: root/rts/Task.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-11-08 09:29:16 -0500
committerBen Gamari <ben@smart-cactus.org>2020-11-08 09:29:16 -0500
commit638f38c50e80a19275f3a06535a0dd8130a17a53 (patch)
treeac18855cd2f39544e4841866fbabb3f86a4d1f35 /rts/Task.c
parentb1d2c1f3246b3740589a59bdf7648c13de47c32b (diff)
parent07e82ba52228580cfbd90ff031e657acbecc715b (diff)
downloadhaskell-638f38c50e80a19275f3a06535a0dd8130a17a53.tar.gz
Merge remote-tracking branch 'origin/wip/tsan/all'
Diffstat (limited to 'rts/Task.c')
-rw-r--r--rts/Task.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/rts/Task.c b/rts/Task.c
index e5963dccc6..2bd32359cc 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -30,6 +30,7 @@
Task *all_tasks = NULL;
// current number of bound tasks + total number of worker tasks.
+// Locks required: all_tasks_mutex.
uint32_t taskCount;
uint32_t workerCount;
uint32_t currentWorkerCount;
@@ -237,6 +238,8 @@ newTask (bool worker)
all_tasks = task;
taskCount++;
+ debugTrace(DEBUG_sched, "new task (taskCount: %d)", taskCount);
+
if (worker) {
workerCount++;
currentWorkerCount++;
@@ -311,8 +314,6 @@ newBoundTask (void)
task->stopped = false;
newInCall(task);
-
- debugTrace(DEBUG_sched, "new task (taskCount: %d)", taskCount);
return task;
}
@@ -472,7 +473,7 @@ startWorkerTask (Capability *cap)
// else get in, because the new worker Task has nowhere to go to
// sleep so that it could be woken up again.
ASSERT_LOCK_HELD(&cap->lock);
- cap->running_task = task;
+ RELAXED_STORE(&cap->running_task, task);
// Set the name of the worker thread to the original process name followed by
// ":w", but only if we're on Linux where the program_invocation_short_name