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-27 15:32:34-08:00
logc155ac50c25c871ea80f27688d2361a3a0bc24d6
treeb8c362629494a6b9e1f7f0f4d6758786d5e5c06f
parent7ab41bec2933ffb2ce136779fbc8c22c45df28a8

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
......@@ -8301,6 +8301,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
83018301
83028302 var io_status_block: windows.IO_STATUS_BLOCK = undefined;
83038303 var done: bool = false;
8304 const infinite: windows.LARGE_INTEGER = windows.INFINITE;
83048305
83058306 read: {
83068307 const syscall: Syscall = try .start();
......@@ -8329,7 +8330,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
83298330 }
83308331 try syscall.toApc(.{ .handle = file.handle, .iosb = &io_status_block });
83318332 while (true) {
8332 switch (windows.ntdll.NtDelayExecution(1, null)) {
8333 switch (windows.ntdll.NtDelayExecution(1, &infinite)) {
83338334 .USER_APC => {
83348335 if (!done) {
83358336 // Other APC work was queued before calling into this function.
......@@ -8338,7 +8339,7 @@ fn fileReadStreamingWindows(file: File, data: []const []u8) File.Reader.Error!us
83388339 }
83398340 break syscall.finishApc();
83408341 },
8341 .SUCCESS, .CANCELLED => {
8342 .SUCCESS, .CANCELLED, .TIMEOUT, .ALERTED => {
83428343 try syscall.checkCancelApc();
83438344 continue;
83448345 },
lib/std/os/windows/ntdll.zig+1-1
......@@ -591,7 +591,7 @@ pub extern "ntdll" fn NtCancelSynchronousIoFile(
591591
592592pub extern "ntdll" fn NtDelayExecution(
593593 Alertable: BOOLEAN,
594 DelayInterval: ?*const LARGE_INTEGER,
594 DelayInterval: *const LARGE_INTEGER,
595595) callconv(.winapi) NTSTATUS;
596596
597597pub extern "ntdll" fn NtCancelIoFileEx(