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 22:03:13-08:00
loga933d7a6f88332a1ab7e1e6079e72a91320d0d4c
treec89e844f65703b10a6cc0bbe253c8b39a9113c33
parente705ad83028b339314fa668ec04d57987ca73e87

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(