authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2025-11-07 13:33:45+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-11-21 19:54:41-08:00
log69f9395b382eb564285367e539d43dc6c8edd257
tree16bcba6f4b466dc8bad7c0a33875138810f3352d
parentff883dd6ce910e2a0aa301e1ee84d93f53cf8765

fix logic bug in groupAsync


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

lib/std/Io/Threaded.zig+4-4
......@@ -695,10 +695,6 @@ fn groupAsync(
695695
696696 t.mutex.lock();
697697
698 // Append to the group linked list inside the mutex to make `Io.Group.async` thread-safe.
699 gc.node = .{ .next = @ptrCast(@alignCast(group.token)) };
700 group.token = &gc.node;
701
702698 if (t.available_thread_count == 0) {
703699 if (t.cpu_count != 0 and t.threads.items.len >= t.cpu_count) {
704700 t.mutex.unlock();
......@@ -727,6 +723,10 @@ fn groupAsync(
727723 t.available_thread_count -= 1;
728724 }
729725
726 // Append to the group linked list inside the mutex to make `Io.Group.async` thread-safe.
727 gc.node = .{ .next = @ptrCast(@alignCast(group.token)) };
728 group.token = &gc.node;
729
730730 t.run_queue.prepend(&gc.closure.node);
731731
732732 // This needs to be done before unlocking the mutex to avoid a race with