aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-05-03 17:57:48 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-05-03 20:58:02 -0700
commita72292513e378159c542a785ca69f8111bacbdcf (patch)
treeaac9e20a88f90e9117b338bcc0e925c7ffa90182 /src/main.zig
parenta96b78c170ef0464e51a1c2fa226c51d49cfde04 (diff)
downloadzig-a72292513e378159c542a785ca69f8111bacbdcf.tar.gz
zig-a72292513e378159c542a785ca69f8111bacbdcf.zip
add std.Thread.Pool.spawnWg
This function accepts a WaitGroup parameter and manages the reference counting therein. It also is infallible. The existing `spawn` function is still handy when the job wants to further schedule more tasks.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig
index 454559954e..d18d085c19 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -5109,8 +5109,9 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
&fetch,
);
- job_queue.wait_group.start();
- try job_queue.thread_pool.spawn(Package.Fetch.workerRun, .{ &fetch, "root" });
+ job_queue.thread_pool.spawnWg(&job_queue.wait_group, Package.Fetch.workerRun, .{
+ &fetch, "root",
+ });
job_queue.wait_group.wait();
try job_queue.consolidateErrors();