summaryrefslogtreecommitdiff
path: root/exercises/104_threading.zig
diff options
context:
space:
mode:
authorChris Boesch <chrboesch@noreply.codeberg.org>2025-08-24 14:59:26 +0200
committerChris Boesch <chrboesch@noreply.codeberg.org>2025-08-24 14:59:26 +0200
commita46db7e0e84718d1898d26b3d798c767792c0779 (patch)
tree9233974b52c566b83c865239fd7c73954315e2b1 /exercises/104_threading.zig
parentf5d2c5124c2728d14d4c349c9287edb00f9eb633 (diff)
parent564ea3405d2dce481001c52b64784b5fce4bd37a (diff)
Merge branch 'main' into test-expect
Diffstat (limited to 'exercises/104_threading.zig')
-rw-r--r--exercises/104_threading.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/exercises/104_threading.zig b/exercises/104_threading.zig
index 9c4e216..638769f 100644
--- a/exercises/104_threading.zig
+++ b/exercises/104_threading.zig
@@ -106,7 +106,7 @@ pub fn main() !void {
// After the threads have been started,
// they run in parallel and we can still do some work in between.
- std.time.sleep(1500 * std.time.ns_per_ms);
+ std.Thread.sleep(1500 * std.time.ns_per_ms);
std.debug.print("Some weird stuff, after starting the threads.\n", .{});
}
// After we have left the closed area, we wait until
@@ -117,12 +117,12 @@ pub fn main() !void {
// This function is started with every thread that we set up.
// In our example, we pass the number of the thread as a parameter.
fn thread_function(num: usize) !void {
- std.time.sleep(200 * num * std.time.ns_per_ms);
+ std.Thread.sleep(200 * num * std.time.ns_per_ms);
std.debug.print("thread {d}: {s}\n", .{ num, "started." });
// This timer simulates the work of the thread.
const work_time = 3 * ((5 - num % 3) - 2);
- std.time.sleep(work_time * std.time.ns_per_s);
+ std.Thread.sleep(work_time * std.time.ns_per_s);
std.debug.print("thread {d}: {s}\n", .{ num, "finished." });
}