improvements for async-io

This commit is contained in:
Chris Boesch
2026-04-06 12:22:41 +02:00
parent 5e474ea5d1
commit 446da3ce5a
2 changed files with 5 additions and 5 deletions

View File

@@ -14,7 +14,7 @@
// * Once you call group.async(), you MUST eventually call // * Once you call group.async(), you MUST eventually call
// group.await() or group.cancel() to release resources. // group.await() or group.cancel() to release resources.
// * group.cancel() requests cancellation on ALL members, // * group.cancel() requests cancellation on ALL members,
// then waits for them to finish. // then blocks until they all finish.
// //
// Unlike Future, Group tasks don't return values to the caller. // Unlike Future, Group tasks don't return values to the caller.
// They're ideal for parallel work that communicates through // They're ideal for parallel work that communicates through
@@ -38,7 +38,7 @@ pub fn main(init: std.process.Init) !void {
// Wait for all tasks to finish. // Wait for all tasks to finish.
// What Group method blocks until all tasks complete? // What Group method blocks until all tasks complete?
try group.??? try group.???(io);
print("All tasks finished!\n", .{}); print("All tasks finished!\n", .{});
} }

View File

@@ -1,10 +1,10 @@
--- exercises/088_async4.zig 2026-04-01 23:17:31.066443941 +0200 --- exercises/088_async4.zig 2026-04-06 12:22:06.643385622 +0200
+++ answers/088_async4.zig 2026-04-01 23:17:39.251612131 +0200 +++ answers/088_async4.zig 2026-04-06 12:22:11.820491035 +0200
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
// Wait for all tasks to finish. // Wait for all tasks to finish.
// What Group method blocks until all tasks complete? // What Group method blocks until all tasks complete?
- try group.??? - try group.???(io);
+ try group.await(io); + try group.await(io);
print("All tasks finished!\n", .{}); print("All tasks finished!\n", .{});