| ... | @@ -695,10 +695,6 @@ fn groupAsync( | ... | @@ -695,10 +695,6 @@ fn groupAsync( |
| 695 | | 695 | |
| 696 | t.mutex.lock(); | 696 | t.mutex.lock(); |
| 697 | | 697 | |
| 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 | | | |
| 702 | if (t.available_thread_count == 0) { | 698 | if (t.available_thread_count == 0) { |
| 703 | if (t.cpu_count != 0 and t.threads.items.len >= t.cpu_count) { | 699 | if (t.cpu_count != 0 and t.threads.items.len >= t.cpu_count) { |
| 704 | t.mutex.unlock(); | 700 | t.mutex.unlock(); |
| ... | @@ -727,6 +723,10 @@ fn groupAsync( | ... | @@ -727,6 +723,10 @@ fn groupAsync( |
| 727 | t.available_thread_count -= 1; | 723 | t.available_thread_count -= 1; |
| 728 | } | 724 | } |
| 729 | | 725 | |
| | 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 | |
| 730 | t.run_queue.prepend(&gc.closure.node); | 730 | t.run_queue.prepend(&gc.closure.node); |
| 731 | | 731 | |
| 732 | // This needs to be done before unlocking the mutex to avoid a race with | 732 | // This needs to be done before unlocking the mutex to avoid a race with |