zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit ed7067a690444a362d289fe5b0a75eefa0de4f08 (tree)
parent e6b4e1a5d0bb7aa8360060ca88cc10a7edc7df5e
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Fri, 24 Oct 2025 06:23:07 -0700

std.Io: more convenient sleep

Diffstat:
Mlib/std/Io.zig | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/std/Io.zig b/lib/std/Io.zig @@ -1604,6 +1604,13 @@ pub fn cancelRequested(io: Io) bool { pub const SleepError = error{UnsupportedClock} || UnexpectedError || Cancelable; +pub fn sleep(io: Io, duration: Duration, clock: Clock) SleepError!void { + return io.vtable.sleep(io.userdata, .{ .duration = .{ + .raw = duration, + .clock = clock, + } }); +} + /// Given a struct with each field a `*Future`, returns a union with the same /// fields, each field type the future's result. pub fn SelectUnion(S: type) type {