You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ziglings/patches/patches/105_threading2.patch

14 lines
499 B
Diff

--- exercises/105_threading2.zig 2024-03-23 16:35:14.754540802 +0100
+++ answers/105_threading2.zig 2024-03-23 16:38:00.577539733 +0100
@@ -81,8 +81,8 @@
defer handle1.join();
// Second thread to calculate the minus numbers.
- ???
-
+ const handle2 = try std.Thread.spawn(.{}, thread_pi, .{ &pi_minus, 3, count });
+ defer handle2.join();
}
// Here we add up the results.
std.debug.print("PI ≈ {d:.8}\n", .{4 + pi_plus - pi_minus});