summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exercises/090_async6.zig7
-rw-r--r--patches/patches/090_async6.patch8
2 files changed, 10 insertions, 5 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}),
diff --git a/patches/patches/090_async6.patch b/patches/patches/090_async6.patch
index 5ac777b..6289708 100644
--- a/patches/patches/090_async6.patch
+++ b/patches/patches/090_async6.patch
@@ -1,10 +1,10 @@
---- exercises/090_async6.zig 2026-04-02 10:25:34.016616118 +0200
-+++ answers/090_async6.zig 2026-04-02 10:27:48.827144051 +0200
-@@ -47,7 +47,7 @@
+--- exercises/090_async6.zig 2026-04-06 18:49:37.232023422 +0200
++++ answers/090_async6.zig 2026-04-06 18:49:22.189720687 +0200
+@@ -52,7 +52,7 @@
// Wait for the first finisher.
// What Select method returns the first completed result?
-- const winner = ???;
+- const winner = try sel.???();
+ const winner = try sel.await();
switch (winner) {