From ba71079837a071b53cab289d78e5bacb4925fd25 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 23 Oct 2024 00:00:17 -0700 Subject: combine codegen work queue and linker task queue these tasks have some shared data dependencies so they cannot be done simultaneously. Future work should untangle these data dependencies so that more can be done in parallel. for now this commit ensures correctness by making linker input parsing and codegen tasks part of the same queue. --- lib/std/Thread/WaitGroup.zig | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/std/Thread/WaitGroup.zig') diff --git a/lib/std/Thread/WaitGroup.zig b/lib/std/Thread/WaitGroup.zig index bdc49587bf..52e9c379c2 100644 --- a/lib/std/Thread/WaitGroup.zig +++ b/lib/std/Thread/WaitGroup.zig @@ -14,6 +14,11 @@ pub fn start(self: *WaitGroup) void { assert((state / one_pending) < (std.math.maxInt(usize) / one_pending)); } +pub fn startMany(self: *WaitGroup, n: usize) void { + const state = self.state.fetchAdd(one_pending * n, .monotonic); + assert((state / one_pending) < (std.math.maxInt(usize) / one_pending)); +} + pub fn finish(self: *WaitGroup) void { const state = self.state.fetchSub(one_pending, .acq_rel); assert((state / one_pending) > 0); -- cgit v1.2.3