mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-07-28 18:25:16 +00:00
14 lines
631 B
Diff
14 lines
631 B
Diff
--- exercises/091_async7.zig 2026-04-18 23:30:40.963951835 +0200
|
|
+++ answers/091_async7.zig 2026-04-18 23:33:47.313340585 +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);
|
|
|
|
// Sleep to give the other tasks a chance to run in the meantime.
|
|
// We do this here only to make nondeterminism more visible.
|