authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-28 18:19:12-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-30 12:10:02-08:00
loga635d62a6b01e9b5b50f5256bef445f5f438a399
tree5c77fbd2dd8be220d0e648bed954a033a1fa6909
parent7ea1d02f9ea767e0d94dbea0437c4216bf69a2c9

std.Io.Threaded.batchWaitWindows: eager result sets any_done true

Thanks jacobly for finding the bug

1 files changed, 4 insertions(+), 1 deletions(-)

lib/std/Io/Threaded.zig+4-1
......@@ -2677,6 +2677,8 @@ fn batchWaitWindows(t: *Threaded, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.Wa
26772677 b.user.complete_tail = complete_tail;
26782678 }
26792679
2680 var any_done = false;
2681
26802682 while (submit_head != submit_tail) : (submit_head = submit_head.next(len)) {
26812683 const op = ring[submit_head.index(len)];
26822684 const operation = &operations[op];
......@@ -2686,6 +2688,7 @@ fn batchWaitWindows(t: *Threaded, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.Wa
26862688 .noop => |*o| {
26872689 _ = o.status.unstarted;
26882690 o.status = .{ .result = {} };
2691 any_done = true;
26892692 submitComplete(ring, &complete_tail, op);
26902693 },
26912694 .file_read_streaming => |*o| {
......@@ -2693,6 +2696,7 @@ fn batchWaitWindows(t: *Threaded, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.Wa
26932696 switch (try ntReadFile(o.file.handle, o.data, &metadata.iosb)) {
26942697 .status => {
26952698 o.status = .{ .result = ntReadFileResult(&metadata.iosb) };
2699 any_done = true;
26962700 submitComplete(ring, &complete_tail, op);
26972701 },
26982702 .pending => {
......@@ -2707,7 +2711,6 @@ fn batchWaitWindows(t: *Threaded, b: *Io.Batch, timeout: Io.Timeout) Io.Batch.Wa
27072711 var delay_interval: windows.LARGE_INTEGER = timeoutToWindowsInterval(timeout);
27082712
27092713 while (true) {
2710 var any_done = false;
27112714 var any_pending = false;
27122715 for (metadatas, 0..) |*metadata, op_usize| {
27132716 if (!metadata.pending) continue;