Skip to content

Commit a97dba8

Browse files
Fix flaky test 'same bucket different addresses' by increasing yields
The test was experiencing race conditions on Windows where the waker would execute before waiters had fully entered the blocked state. This caused the test to be flaky - sometimes passing with woken=1, sometimes failing with woken=0. Increased the yield count from 10 to 100 iterations to ensure waiters have sufficient time to block before the wake call, especially on Windows where scheduler timing differs from Linux. Co-authored-by: Lukáš Lalinský <[email protected]>
1 parent 39e1372 commit a97dba8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/sync/Futex.zig‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,9 @@ test "Futex: same bucket different addresses" {
381381
}
382382

383383
fn wakerFunc(io: *Runtime, val: *u32) !void {
384-
// Yield multiple times to ensure waiters have time to block
384+
// Yield multiple times to ensure waiters have time to block (especially on Windows)
385385
var i: usize = 0;
386-
while (i < 10) : (i += 1) {
386+
while (i < 100) : (i += 1) {
387387
try io.yield();
388388
}
389389
std.debug.print("wakerFunc waking addr=0x{x}\n", .{@intFromPtr(val)});

0 commit comments

Comments
 (0)