diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-05-03 17:57:48 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-05-03 20:58:02 -0700 |
| commit | a72292513e378159c542a785ca69f8111bacbdcf (patch) | |
| tree | aac9e20a88f90e9117b338bcc0e925c7ffa90182 /src/main.zig | |
| parent | a96b78c170ef0464e51a1c2fa226c51d49cfde04 (diff) | |
| download | zig-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.zig | 5 |
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(); |
