authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-08 01:32:04+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-08 01:32:04+02:00
log2597da02544c05f7de6c209d9d4d509b74e63f73
tree0260113ab2fdf97375fad4c92df145b485d096e6
parenteff54d672b863c46c3df7f7bbc7239dd585e83f8
parent47825d7de3b9b26ab1dd7bca669b693bca2995e8

Merge pull request 'std.Io: minor Timeout-related things' (#35299) from blblack/zig:io-minor-stuff into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35299

2 files changed, 2 insertions(+), 1 deletions(-)

lib/std/Io.zig+2
......@@ -467,6 +467,7 @@ pub const OperateTimeoutError = Cancelable || Timeout.Error || ConcurrentError;
467467
468468/// Performs one `Operation` with provided `timeout`.
469469pub fn operateTimeout(io: Io, operation: Operation, timeout: Timeout) OperateTimeoutError!Operation.Result {
470 if (timeout == .none) return io.vtable.operate(io.userdata, operation);
470471 var storage: [1]Operation.Storage = undefined;
471472 var batch: Batch = .init(&storage);
472473 batch.addAt(0, operation);
......@@ -1147,6 +1148,7 @@ pub const Duration = struct {
11471148
11481149/// Declares under what conditions an operation should return `error.Timeout`.
11491150pub const Timeout = union(enum) {
1151 /// `.none` will wait forever
11501152 none,
11511153 duration: Clock.Duration,
11521154 deadline: Clock.Timestamp,
lib/std/Io/Threaded.zig-1
......@@ -11771,7 +11771,6 @@ fn nowWasi(clock: Io.Clock) Io.Timestamp {
1177111771
1177211772fn sleep(userdata: ?*anyopaque, timeout: Io.Timeout) Io.Cancelable!void {
1177311773 const t: *Threaded = @ptrCast(@alignCast(userdata));
11774 if (timeout == .none) return;
1177511774 if (use_parking_sleep) return parking_sleep.sleep(timeout);
1177611775 if (native_os == .wasi) return sleepWasi(t, timeout);
1177711776 if (@TypeOf(posix.system.clock_nanosleep) != void) return sleepPosix(timeout);