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-30 12:10:01-08:00
log29f44952c118be655e152b8f6c4ae78a0cc619a9
tree7db4cf483171c8241d7d6ea51760bd272dd0199f
parent9240881806ef23c504d0312ed7f89f3b5c48aaf3

std.Io.Threaded: fix NtDelayExecution delay interval


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

lib/std/Io/Threaded.zig+3-3
...@@ -8372,7 +8372,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us...@@ -8372,7 +8372,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
83728372
8373 var io_status_block: windows.IO_STATUS_BLOCK = undefined;8373 var io_status_block: windows.IO_STATUS_BLOCK = undefined;
8374 var done: bool = false;8374 var done: bool = false;
8375 const infinite: windows.LARGE_INTEGER = windows.INFINITE;8375 const max_delay_interval: windows.LARGE_INTEGER = std.math.minInt(i64);
83768376
8377 read: {8377 read: {
8378 const syscall: Syscall = try .start();8378 const syscall: Syscall = try .start();
...@@ -8404,7 +8404,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us...@@ -8404,7 +8404,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
8404 // Once we get here we received PENDING so we must not return from the8404 // Once we get here we received PENDING so we must not return from the
8405 // function until the operation completes.8405 // function until the operation completes.
8406 defer while (!done) {8406 defer while (!done) {
8407 _ = windows.ntdll.NtDelayExecution(1, &infinite);8407 _ = windows.ntdll.NtDelayExecution(1, &max_delay_interval);
8408 };8408 };
84098409
8410 const alertable_syscall = syscall.toAlertable() catch |err| switch (err) {8410 const alertable_syscall = syscall.toAlertable() catch |err| switch (err) {
...@@ -8415,7 +8415,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us...@@ -8415,7 +8415,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
8415 };8415 };
8416 defer alertable_syscall.finish();8416 defer alertable_syscall.finish();
8417 while (!done) {8417 while (!done) {
8418 _ = windows.ntdll.NtDelayExecution(1, &infinite);8418 _ = windows.ntdll.NtDelayExecution(1, &max_delay_interval);
8419 alertable_syscall.checkCancel() catch |err| switch (err) {8419 alertable_syscall.checkCancel() catch |err| switch (err) {
8420 error.Canceled => |e| {8420 error.Canceled => |e| {
8421 _ = windows.ntdll.NtCancelIoFile(file.handle, &io_status_block);8421 _ = windows.ntdll.NtCancelIoFile(file.handle, &io_status_block);