mirror of
https://git.aramjonghu.dev/AramJonghu/ziglings.git
synced 2026-09-03 17:03:30 +02:00
18 lines
724 B
Diff
18 lines
724 B
Diff
--- exercises/107_threading.zig 2026-04-01 23:31:10.073198955 +0200
|
|
+++ answers/107_threading.zig 2026-04-02 10:51:15.809831617 +0200
|
|
@@ -88,12 +88,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.
|