authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-16 21:39:03-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-30 12:10:01-08:00
log0f1a78b55405b586791d2a56ea96ff96a73f46d5
tree26ff6de99b9d296e996a097e767e1a719d5a1b3c
parentcfd142c4c6057bcfe66dfd2e98dfbf5111b1afcf

std.Io.Threaded: fix compilation failures on Windows

it's still broken as hell tho

1 files changed, 15 insertions(+), 11 deletions(-)

lib/std/Io/Threaded.zig+15-11
......@@ -1323,7 +1323,10 @@ fn waitForApcOrAlert() void {
13231323
13241324const max_iovecs_len = 8;
13251325const splat_buffer_size = 64;
1326const poll_buffer_len = 32;
1326/// Happens to be the same number that matches maximum number of handles that
1327/// NtWaitForMultipleObjects accepts. We use this value also for poll() on
1328/// posix systems.
1329const poll_buffer_len = 64;
13271330const default_PATH = "/usr/local/bin:/bin/:/usr/bin";
13281331
13291332comptime {
......@@ -2635,18 +2638,13 @@ fn batchWaitWindows(t: *Threaded, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.Wa
26352638 overlapped.* = .{
26362639 .Internal = 0,
26372640 .InternalHigh = 0,
2638 .DUMMYUNIONNAME = .{
2639 .DUMMYSTRUCTNAME = .{
2640 .Offset = 0,
2641 .OffsetHigh = 0,
2642 },
2643 .Pointer = null,
2644 },
2641 .DUMMYUNIONNAME = .{ .Pointer = null },
26452642 .hEvent = null,
26462643 };
26472644 var n: windows.DWORD = undefined;
26482645 const buf = o.data[0];
2649 if (windows.kernel32.ReadFile(o.file.handle, buf.ptr, buf.len, &n, overlapped) == 0) {
2646 const buf_len = std.math.lossyCast(windows.DWORD, buf.len);
2647 if (windows.kernel32.ReadFile(o.file.handle, buf.ptr, buf_len, &n, overlapped) == 0) {
26502648 @panic("TODO");
26512649 }
26522650 handles_buffer[buffer_i] = o.file.handle;
......@@ -2663,6 +2661,7 @@ fn batchWaitWindows(t: *Threaded, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.Wa
26632661 try operate(t, &operations[op]);
26642662 ring[complete_tail.index(len)] = op;
26652663 complete_tail = complete_tail.next(len);
2664 buffer_i = 0;
26662665 return;
26672666 },
26682667 else => {},
......@@ -2672,10 +2671,15 @@ fn batchWaitWindows(t: *Threaded, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.Wa
26722671 const map = map_buffer[0..buffer_i];
26732672
26742673 const syscall: Syscall = try .start();
2675 const index = windows.WaitForMultipleObjectsEx(handles, false, windows.INFINITE, true);
2674 const index_result = windows.WaitForMultipleObjectsEx(handles, false, windows.INFINITE, true);
26762675 syscall.finish();
2676 const index = index_result catch |err| switch (err) {
2677 error.Unexpected => @panic("TODO"),
2678 error.WaitAbandoned => @panic("TODO"),
2679 error.WaitTimeOut => @panic("TODO"),
2680 };
26772681 var n: windows.DWORD = undefined;
2678 if (0 == windows.kernel32.GetOverlappedResult(handles[index], overlapped_buffer[index], &n, 0)) {
2682 if (0 == windows.kernel32.GetOverlappedResult(handles[index], &overlapped_buffer[index], &n, 0)) {
26792683 switch (windows.GetLastError()) {
26802684 .BROKEN_PIPE => @panic("TODO"),
26812685 .OPERATION_ABORTED => @panic("TODO"),