From d65e3f3f9a42d9eb1695e50763b2a81f745f5596 Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Sat, 23 Mar 2024 16:42:27 +0100 Subject: Added second threading exercise. --- patches/patches/105_threading2.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 patches/patches/105_threading2.patch (limited to 'patches') diff --git a/patches/patches/105_threading2.patch b/patches/patches/105_threading2.patch new file mode 100644 index 0000000..dfa5613 --- /dev/null +++ b/patches/patches/105_threading2.patch @@ -0,0 +1,13 @@ +--- 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}); -- cgit v1.2.3-70-g09d2