diff options
author | Chris Boesch <chrboesch@noreply.codeberg.org> | 2024-03-05 08:22:40 +0000 |
---|---|---|
committer | Chris Boesch <chrboesch@noreply.codeberg.org> | 2024-03-05 08:22:40 +0000 |
commit | 9e9cf40453d57486a9f246e0ec1d0b5aeb645613 (patch) | |
tree | 0a96910870f113d4ee266e2e27c46c2bb77dd66e /patches | |
parent | 277304454a8f18b65985d61cc62c01d00b9dc2d0 (diff) | |
parent | 6984345d0af6fb88438ad260fb9146bc8c36466b (diff) |
Merge pull request 'Added threading exercise' (#54) from 104_threading into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/54
Diffstat (limited to 'patches')
-rw-r--r-- | patches/patches/104_threading.patch | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/patches/patches/104_threading.patch b/patches/patches/104_threading.patch new file mode 100644 index 0000000..58410a8 --- /dev/null +++ b/patches/patches/104_threading.patch @@ -0,0 +1,17 @@ +--- exercises/104_threading.zig 2024-03-05 09:09:04.013974229 +0100 ++++ answers/104_threading.zig 2024-03-05 09:12:03.987162883 +0100 +@@ -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. |