diff options
| author | Chris Boesch <chrboesch@noreply.codeberg.org> | 2026-04-06 20:56:29 +0200 |
|---|---|---|
| committer | Chris Boesch <chrboesch@noreply.codeberg.org> | 2026-04-06 20:56:29 +0200 |
| commit | 3574fd3ae037f34510c6bb6657332b57447ac5b1 (patch) | |
| tree | cb359b2d95b245aba70e5636fd3ea5f4648a4fd6 /exercises/090_async6.zig | |
| parent | 966c1f83af33f6b3f2312a2e4613247097f9ae38 (diff) | |
| parent | 882c6aa0ab174f0d7a28a7804531611fcef98476 (diff) | |
Merge pull request 'Improvements for async-io' (#388) from async-improvements into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/388
Diffstat (limited to 'exercises/090_async6.zig')
| -rw-r--r-- | exercises/090_async6.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/exercises/090_async6.zig b/exercises/090_async6.zig index eab03c9..16fb75f 100644 --- a/exercises/090_async6.zig +++ b/exercises/090_async6.zig @@ -23,6 +23,11 @@ // } // sel.cancelDiscard(); // cancel remaining, discard results // +// As with all async primitives: tasks spawned in a Select MUST +// be cleaned up. Use sel.cancel() to get remaining results one +// by one (for resource cleanup), or sel.cancelDiscard() if you +// don't need them. +// // The buffer must be large enough for all tasks that might // complete before you call cancelDiscard(). // @@ -47,7 +52,7 @@ pub fn main(init: std.process.Init) !void { // Wait for the first finisher. // What Select method returns the first completed result? - const winner = ???; + const winner = try sel.???(); switch (winner) { .hare => |msg| print("Hare: {s}\n", .{msg}), |
