diff options
Diffstat (limited to 'patches')
| -rw-r--r-- | patches/patches/093_async9.patch | 6 | ||||
| -rw-r--r-- | patches/patches/095_quiz_async.patch | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/patches/patches/093_async9.patch b/patches/patches/093_async9.patch index cb47f76..4aa54a1 100644 --- a/patches/patches/093_async9.patch +++ b/patches/patches/093_async9.patch @@ -1,14 +1,14 @@ ---- exercises/093_async9.zig 2026-04-14 22:06:23.644776893 +0200 +--- exercises/093_async9.zig 2026-04-14 22:20:23.519107582 +0200 +++ answers/093_async9.zig 2026-04-14 22:06:30.606912044 +0200 @@ -63,10 +63,10 @@ // Launch two workers, each searching half the array. // Remember, we want them to be guaranteed separate units of concurrency. -- var f1 = ???(searchRange, .{ data[0..mid], target, 0, 0, &queue, io }); +- var f1 = ???(searchThreshold, .{ io, data[0..mid], threshold, 0, 0, &queue }); + var f1 = try io.concurrent(searchThreshold, .{ io, data[0..mid], threshold, 0, 0, &queue }); defer _ = f1.cancel(io); -- var f2 = ???(searchRange, .{ data[mid..], target, mid, 1, &queue, io }); +- var f2 = ???(searchThreshold, .{ io, data[mid..], threshold, mid, 1, &queue }); + var f2 = try io.concurrent(searchThreshold, .{ io, data[mid..], threshold, mid, 1, &queue }); defer _ = f2.cancel(io); diff --git a/patches/patches/095_quiz_async.patch b/patches/patches/095_quiz_async.patch index e3d2a79..78f7944 100644 --- a/patches/patches/095_quiz_async.patch +++ b/patches/patches/095_quiz_async.patch @@ -1,5 +1,5 @@ ---- exercises/095_quiz_async.zig 2026-04-06 19:55:17.111817364 +0200 -+++ answers/095_quiz_async.zig 2026-04-06 19:56:16.063974543 +0200 +--- exercises/095_quiz_async.zig 2026-04-13 19:11:04.173440326 -0700 ++++ answers/095_quiz_async.zig 2026-04-13 19:10:31.618592222 -0700 @@ -51,7 +51,7 @@ fn addReading(self: *GardenWeather, io: std.Io, reading: Reading) void { // Bug 1: The collector needs to lock before modifying @@ -18,7 +18,7 @@ defer _ = collector_future.cancel(io); // Sensor group: the sensors can use async — they just need -@@ -91,7 +91,7 @@ +@@ -91,22 +91,22 @@ // Bug 3: Wait for ALL sensors to finish sending their readings. // What Group method blocks until all tasks complete? @@ -27,11 +27,11 @@ // All sensors done — close the queue so the collector knows // there's no more data coming. -@@ -99,15 +99,14 @@ + queue.close(io); - // Wait for the collector to drain the remaining queue. - _ = collector_future.await(io); -- // _ = collector_future.???(io); + // Bug 4: How do we wait for the collector to drain the remaining queue? +- _ = collector_future.???(io); ++ _ = collector_future.await(io); // Now write the garden report. This is critical — it must // NOT be interrupted, even if something tries to cancel us! @@ -45,7 +45,7 @@ printGardenReport(&weather); } -@@ -129,7 +128,7 @@ +@@ -128,7 +128,7 @@ // Bug 6: Send the reading into the queue. // What Queue method sends a single element? |
