mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
std.Io: more convenient sleep
This commit is contained in:
parent
e6b4e1a5d0
commit
ed7067a690
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user