authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-21 21:42:23-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-30 12:10:01-08:00
log84303546ba603623070932432efb43c413d48a0e
treef95e20d9f135e5d7b1c5244011c725df6ffea83f
parent36940c39539e5d4d8a39ceaed035f213b3902c92

std.Io.Threaded: don't pass null to NtDelayExecution

Windows returns ACCESS_VIOLATION if you do that.

2 files changed, 4 insertions(+), 3 deletions(-)

lib/std/Io/Threaded.zig+3-2
......@@ -8444,6 +8444,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
84448444
84458445 var io_status_block: windows.IO_STATUS_BLOCK = undefined;
84468446 var done: bool = false;
8447 const infinite: windows.LARGE_INTEGER = windows.INFINITE;
84478448
84488449 read: {
84498450 const syscall: Syscall = try .start();
......@@ -8472,7 +8473,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
84728473 }
84738474 try syscall.toApc(.{ .handle = file.handle, .iosb = &io_status_block });
84748475 while (true) {
8475 switch (windows.ntdll.NtDelayExecution(1, null)) {
8476 switch (windows.ntdll.NtDelayExecution(1, &infinite)) {
84768477 .USER_APC => {
84778478 if (!done) {
84788479 // Other APC work was queued before calling into this function.
......@@ -8481,7 +8482,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
84818482 }
84828483 break syscall.finishApc();
84838484 },
8484 .SUCCESS, .CANCELLED => {
8485 .SUCCESS, .CANCELLED, .TIMEOUT, .ALERTED => {
84858486 try syscall.checkCancelApc();
84868487 continue;
84878488 },
lib/std/os/windows/ntdll.zig+1-1
......@@ -596,7 +596,7 @@ pub extern "ntdll" fn NtCancelSynchronousIoFile(
596596
597597pub extern "ntdll" fn NtDelayExecution(
598598 Alertable: BOOLEAN,
599 DelayInterval: ?*const LARGE_INTEGER,
599 DelayInterval: *const LARGE_INTEGER,
600600) callconv(.winapi) NTSTATUS;
601601
602602pub extern "ntdll" fn NtCancelIoFileEx(