diff options
| author | Chris Boesch <chrboesch@noreply.codeberg.org> | 2025-07-22 10:52:04 +0200 |
|---|---|---|
| committer | Chris Boesch <chrboesch@noreply.codeberg.org> | 2025-07-22 10:52:04 +0200 |
| commit | 1f6ce9a2684149c99606ba2ccbfa7092d72cdeae (patch) | |
| tree | 2edab32995d90203155546ef575bbd9db45c377b /exercises/104_threading.zig | |
| parent | b9a372bde810939c35d90fd7fc98bc262e7632d8 (diff) | |
| parent | 4044b93dd210cb3eb8c1993f2be0e286c4383f2f (diff) | |
Merge pull request 'Fix zig 0.15.0-dev.1149+4e6a04929 build errors' (#283) from zawupf/ziglings-exercises:zig-0.15 into main
Reviewed-on: https://codeberg.org/ziglings/exercises/pulls/283
Diffstat (limited to 'exercises/104_threading.zig')
| -rw-r--r-- | exercises/104_threading.zig | 6 |
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." }); } |
