| ... | ... | @@ -1323,7 +1323,10 @@ fn waitForApcOrAlert() void { |
| 1323 | 1323 | |
| 1324 | 1324 | const max_iovecs_len = 8; |
| 1325 | 1325 | const splat_buffer_size = 64; |
| 1326 | | const 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. |
| 1329 | const poll_buffer_len = 64; |
| 1327 | 1330 | const default_PATH = "/usr/local/bin:/bin/:/usr/bin"; |
| 1328 | 1331 | |
| 1329 | 1332 | comptime { |
| ... | ... | @@ -2635,18 +2638,13 @@ fn batchWaitWindows(t: *Threaded, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.Wa |
| 2635 | 2638 | overlapped.* = .{ |
| 2636 | 2639 | .Internal = 0, |
| 2637 | 2640 | .InternalHigh = 0, |
| 2638 | | .DUMMYUNIONNAME = .{ |
| 2639 | | .DUMMYSTRUCTNAME = .{ |
| 2640 | | .Offset = 0, |
| 2641 | | .OffsetHigh = 0, |
| 2642 | | }, |
| 2643 | | .Pointer = null, |
| 2644 | | }, |
| 2641 | .DUMMYUNIONNAME = .{ .Pointer = null }, |
| 2645 | 2642 | .hEvent = null, |
| 2646 | 2643 | }; |
| 2647 | 2644 | var n: windows.DWORD = undefined; |
| 2648 | 2645 | 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) { |
| 2650 | 2648 | @panic("TODO"); |
| 2651 | 2649 | } |
| 2652 | 2650 | handles_buffer[buffer_i] = o.file.handle; |
| ... | ... | @@ -2663,6 +2661,7 @@ fn batchWaitWindows(t: *Threaded, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.Wa |
| 2663 | 2661 | try operate(t, &operations[op]); |
| 2664 | 2662 | ring[complete_tail.index(len)] = op; |
| 2665 | 2663 | complete_tail = complete_tail.next(len); |
| 2664 | buffer_i = 0; |
| 2666 | 2665 | return; |
| 2667 | 2666 | }, |
| 2668 | 2667 | else => {}, |
| ... | ... | @@ -2672,10 +2671,15 @@ fn batchWaitWindows(t: *Threaded, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.Wa |
| 2672 | 2671 | const map = map_buffer[0..buffer_i]; |
| 2673 | 2672 | |
| 2674 | 2673 | 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); |
| 2676 | 2675 | 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 | }; |
| 2677 | 2681 | 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)) { |
| 2679 | 2683 | switch (windows.GetLastError()) { |
| 2680 | 2684 | .BROKEN_PIPE => @panic("TODO"), |
| 2681 | 2685 | .OPERATION_ABORTED => @panic("TODO"), |