From 6984345d0af6fb88438ad260fb9146bc8c36466b Mon Sep 17 00:00:00 2001 From: Chris Boesch Date: Tue, 5 Mar 2024 09:15:57 +0100 Subject: Added threading exercise --- patches/patches/104_threading.patch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 patches/patches/104_threading.patch (limited to 'patches') 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. -- cgit v1.2.3-70-g09d2