mirror of
https://codeberg.org/ziglings/exercises.git
synced 2025-06-08 01:57:02 +09:00
Added second threading exercise.
This commit is contained in:
parent
cdaa246131
commit
d65e3f3f9a
4 changed files with 124 additions and 1 deletions
13
patches/patches/105_threading2.patch
Normal file
13
patches/patches/105_threading2.patch
Normal file
|
@ -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});
|
Loading…
Add table
Add a link
Reference in a new issue