new async exercise

This commit is contained in:
Chris Boesch
2026-04-03 14:28:19 +02:00
parent 903c33cd0a
commit 2500936153
3 changed files with 91 additions and 4 deletions

View File

@@ -0,0 +1,13 @@
--- exercises/093_async10.zig 2026-04-03 14:25:16.600025924 +0200
+++ answers/093_async10.zig 2026-04-03 14:24:56.192615893 +0200
@@ -50,8 +50,8 @@
// Protect this section from cancellation.
// What method swaps the cancel protection state?
- const old = io.???(. blocked);
- defer _ = io.???(old);
+ const old = io.swapCancelProtection(.blocked);
+ defer _ = io.swapCancelProtection(old);
// This sleep will NOT return error.Canceled even though
// we get canceled during it — protection is active!