summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-12-01 21:45:29 -0500
committerBen Gamari <ben@well-typed.com>2020-12-01 12:48:53 -0500
commit20a89e98a220d85353d74487d6abe90a527e76d1 (patch)
tree4b279feafb7b29a5b877f4fc471a88a403de6370
parent886440550dfec246ea688ef6bba93bea73502c0d (diff)
downloadhaskell-20a89e98a220d85353d74487d6abe90a527e76d1.tar.gz
rts/Task: Move debugTrace to avoid data race
Specifically, we need to hold all_tasks_mutex to read taskCount.
-rw-r--r--rts/Task.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rts/Task.c b/rts/Task.c
index c471d4afee..9311a16ce0 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -238,6 +238,8 @@ newTask (bool worker)
all_tasks = task;
taskCount++;
+ debugTrace(DEBUG_sched, "new task (taskCount: %d)", taskCount);
+
if (worker) {
workerCount++;
currentWorkerCount++;
@@ -312,8 +314,6 @@ newBoundTask (void)
task->stopped = false;
newInCall(task);
-
- debugTrace(DEBUG_sched, "new task (taskCount: %d)", taskCount);
return task;
}