authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-23 00:03:37-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-27 15:32:34-08:00
log041add45ad37522f1b3dea8daec0808b5dc55d1d
treeda22d57fa1f7b1eb9a952c63bede537b389bf46b
parent79be6b7ffe6170cd6560637c2eaed0bc8dc96354

std.Io.Threaded: fix NtDelayExecution delay interval


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

lib/std/Io/Threaded.zig+3-3
...@@ -8229,7 +8229,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us...@@ -8229,7 +8229,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
82298229
8230 var io_status_block: windows.IO_STATUS_BLOCK = undefined;8230 var io_status_block: windows.IO_STATUS_BLOCK = undefined;
8231 var done: bool = false;8231 var done: bool = false;
8232 const infinite: windows.LARGE_INTEGER = windows.INFINITE;8232 const max_delay_interval: windows.LARGE_INTEGER = std.math.minInt(i64);
82338233
8234 read: {8234 read: {
8235 const syscall: Syscall = try .start();8235 const syscall: Syscall = try .start();
...@@ -8261,7 +8261,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us...@@ -8261,7 +8261,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
8261 // Once we get here we received PENDING so we must not return from the8261 // Once we get here we received PENDING so we must not return from the
8262 // function until the operation completes.8262 // function until the operation completes.
8263 defer while (!done) {8263 defer while (!done) {
8264 _ = windows.ntdll.NtDelayExecution(1, &infinite);8264 _ = windows.ntdll.NtDelayExecution(1, &max_delay_interval);
8265 };8265 };
82668266
8267 const alertable_syscall = syscall.toAlertable() catch |err| switch (err) {8267 const alertable_syscall = syscall.toAlertable() catch |err| switch (err) {
...@@ -8272,7 +8272,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us...@@ -8272,7 +8272,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
8272 };8272 };
8273 defer alertable_syscall.finish();8273 defer alertable_syscall.finish();
8274 while (!done) {8274 while (!done) {
8275 _ = windows.ntdll.NtDelayExecution(1, &infinite);8275 _ = windows.ntdll.NtDelayExecution(1, &max_delay_interval);
8276 alertable_syscall.checkCancel() catch |err| switch (err) {8276 alertable_syscall.checkCancel() catch |err| switch (err) {
8277 error.Canceled => |e| {8277 error.Canceled => |e| {
8278 _ = windows.ntdll.NtCancelIoFile(file.handle, &io_status_block);8278 _ = windows.ntdll.NtCancelIoFile(file.handle, &io_status_block);