| author | |
| committer | |
| log | 2597da02544c05f7de6c209d9d4d509b74e63f73 |
| tree | 0260113ab2fdf97375fad4c92df145b485d096e6 |
| parent | eff54d672b863c46c3df7f7bbc7239dd585e83f8 |
| parent | 47825d7de3b9b26ab1dd7bca669b693bca2995e8 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/352992 files changed, 2 insertions(+), 1 deletions(-)
lib/std/Io.zig+2| ... | ... | @@ -467,6 +467,7 @@ pub const OperateTimeoutError = Cancelable || Timeout.Error || ConcurrentError; |
| 467 | 467 | |
| 468 | 468 | /// Performs one `Operation` with provided `timeout`. |
| 469 | 469 | pub fn operateTimeout(io: Io, operation: Operation, timeout: Timeout) OperateTimeoutError!Operation.Result { |
| 470 | if (timeout == .none) return io.vtable.operate(io.userdata, operation); | |
| 470 | 471 | var storage: [1]Operation.Storage = undefined; |
| 471 | 472 | var batch: Batch = .init(&storage); |
| 472 | 473 | batch.addAt(0, operation); |
| ... | ... | @@ -1147,6 +1148,7 @@ pub const Duration = struct { |
| 1147 | 1148 | |
| 1148 | 1149 | /// Declares under what conditions an operation should return `error.Timeout`. |
| 1149 | 1150 | pub const Timeout = union(enum) { |
| 1151 | /// `.none` will wait forever | |
| 1150 | 1152 | none, |
| 1151 | 1153 | duration: Clock.Duration, |
| 1152 | 1154 | deadline: Clock.Timestamp, |
lib/std/Io/Threaded.zig-1| ... | ... | @@ -11771,7 +11771,6 @@ fn nowWasi(clock: Io.Clock) Io.Timestamp { |
| 11771 | 11771 | |
| 11772 | 11772 | fn sleep(userdata: ?*anyopaque, timeout: Io.Timeout) Io.Cancelable!void { |
| 11773 | 11773 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| 11774 | if (timeout == .none) return; | |
| 11775 | 11774 | if (use_parking_sleep) return parking_sleep.sleep(timeout); |
| 11776 | 11775 | if (native_os == .wasi) return sleepWasi(t, timeout); |
| 11777 | 11776 | if (@TypeOf(posix.system.clock_nanosleep) != void) return sleepPosix(timeout); |