revival of the async-io functions, #90

This commit is contained in:
Chris Boesch
2026-04-02 10:38:45 +02:00
parent 3b22bfd898
commit ffde357f30
3 changed files with 58 additions and 79 deletions

View File

@@ -0,0 +1,13 @@
--- exercises/090_async7.zig 2026-04-02 10:36:42.910708919 +0200
+++ answers/090_async7.zig 2026-04-02 10:36:51.965884223 +0200
@@ -49,8 +49,8 @@
for (0..times) |_| {
// Acquire the lock before modifying shared state.
// What Mutex method blocks until the lock is acquired?
- state.mutex.??? catch return;
- defer state.mutex.unlock(); // <-- what's missing here?
+ state.mutex.lock(io) catch return;
+ defer state.mutex.unlock(io);
state.counter += 1;
}