mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-08 07:50:00 +00:00
improvements for async-io
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
--- exercises/087_async3.zig 2026-04-01 22:51:05.540094851 +0200
|
||||
+++ answers/087_async3.zig 2026-04-01 22:50:44.579669189 +0200
|
||||
@@ -29,12 +29,12 @@
|
||||
const io = init.io;
|
||||
|
||||
--- exercises/087_async3.zig 2026-04-05 16:12:48.317265515 +0200
|
||||
+++ answers/087_async3.zig 2026-04-05 16:12:52.269343030 +0200
|
||||
@@ -28,7 +28,7 @@
|
||||
// Launch both tasks asynchronously.
|
||||
- var future_a = io.async(slowAdd, .{ 10, 20 });
|
||||
var future_a = io.async(slowAdd, .{ 1, 2 });
|
||||
defer _ = future_a.cancel(io);
|
||||
- var future_b = ???(slowMul, .{ 6, 7 });
|
||||
+ var future_a = io.async(slowAdd, .{ 1, 2 });
|
||||
+ var future_b = io.async(slowMul, .{ 6, 7 });
|
||||
defer _ = future_b.cancel(io);
|
||||
|
||||
// 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 });
|
||||
|
||||
Reference in New Issue
Block a user