authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-24 06:23:07-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-29 06:20:51-07:00
loged7067a690444a362d289fe5b0a75eefa0de4f08
tree7aa55c190871d24f64c1832647ab657160259f15
parente6b4e1a5d0bb7aa8360060ca88cc10a7edc7df5e

std.Io: more convenient sleep


1 files changed, 7 insertions(+), 0 deletions(-)

lib/std/Io.zig+7
......@@ -1604,6 +1604,13 @@ pub fn cancelRequested(io: Io) bool {
16041604
16051605pub const SleepError = error{UnsupportedClock} || UnexpectedError || Cancelable;
16061606
1607pub fn sleep(io: Io, duration: Duration, clock: Clock) SleepError!void {
1608 return io.vtable.sleep(io.userdata, .{ .duration = .{
1609 .raw = duration,
1610 .clock = clock,
1611 } });
1612}
1613
16071614/// Given a struct with each field a `*Future`, returns a union with the same
16081615/// fields, each field type the future's result.
16091616pub fn SelectUnion(S: type) type {