revival of the async-io functions

This commit is contained in:
Chris Boesch
2026-04-01 22:52:04 +02:00
parent 6d89dcd2de
commit db1fef8b86
3 changed files with 64 additions and 26 deletions

View File

@@ -0,0 +1,18 @@
--- exercises/086_async3.zig 2026-04-01 22:51:05.540094851 +0200
+++ answers/086_async3.zig 2026-04-01 22:50:44.579669189 +0200
@@ -29,12 +29,12 @@
const io = init.io;
// Launch both tasks asynchronously.
- var future_a = io.async(slowAdd, .{ 10, 20 });
- var future_b = ???(slowMul, .{ 6, 7 });
+ var future_a = io.async(slowAdd, .{ 1, 2 });
+ var future_b = io.async(slowMul, .{ 6, 7 });
// Await both results.
const sum = future_a.await(io);
- const product = future_b.???(io);
+ const product = future_b.await(io);
print("{} + {} = {}\n", .{ 1, 2, sum });
print("{} * {} = {}\n", .{ 6, 7, product });