17 lines
724 B
Diff
17 lines
724 B
Diff
--- exercises/104_threading.zig 2024-04-10 19:12:29.878856370 +0200
|
|
+++ answers/104_threading.zig 2024-04-10 19:11:22.304265713 +0200
|
|
@@ -97,12 +97,12 @@
|
|
defer handle.join();
|
|
|
|
// Second thread
|
|
- const handle2 = try std.Thread.spawn(.{}, thread_function, .{-4}); // that can't be right?
|
|
+ const handle2 = try std.Thread.spawn(.{}, thread_function, .{2});
|
|
defer handle2.join();
|
|
|
|
// Third thread
|
|
const handle3 = try std.Thread.spawn(.{}, thread_function, .{3});
|
|
- defer ??? // <-- something is missing
|
|
+ defer handle3.join();
|
|
|
|
// After the threads have been started,
|
|
// they run in parallel and we can still do some work in between.
|