From e9168f653b312504cbea0886d6107e9a8bf84c2d Mon Sep 17 00:00:00 2001 From: lunaeme Date: Tue, 1 Dec 2026 10:47:51 -0300 Subject: [PATCH] Tests: the generation release probe waits out another test's LISTS lock `bundle_generations_propagate_and_final_release_runs_outside_lists` checks that the final COM Release of a native generation runs outside LISTS by calling `LISTS.try_lock()` inside the fake Release. LISTS is process-wide, so when another test's thread holds it at that moment the probe reports "final COM Release ran under LISTS" although the release ran outside it. On main b2b1f10 (RTX 3060), `list_x::tests::` at --test-threads=8 failed it in 8 of 60 runs. The probe now retries try_lock for up to a second. Another thread lets LISTS go within that time; this thread holding it makes every try fail, so a release under LISTS is still caught: dropping the generations inside the lock in `clear_segment_state` fails the test (after the 1 s wait). With the change, 0 of 60 module runs failed it. Co-Authored-By: Claude Opus 5.5 --- crates/xcl/src/hle/d3d12x/list_x.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/xcl/src/hle/d3d12x/list_x.rs b/crates/xcl/src/hle/d3d12x/list_x.rs index 638b133d13..c9e1b6e961 100644 --- a/crates/xcl/src/hle/d3d12x/list_x.rs +++ b/crates/xcl/src/hle/d3d12x/list_x.rs @@ -7411,7 +7411,19 @@ mod tests { let n = (*(this as *mut ReentrantGenerationPso)).refs.fetch_sub(1, Ordering::Relaxed) - 1; let probe = (*(this as *mut ReentrantGenerationPso)).release_outside_lists; if n == 0 && !probe.is_null() { - (*probe).store(LISTS.try_lock().is_ok(), Ordering::Release); + // LISTS is process-wide, so another test's thread can hold it for a moment; only + // this thread holding it keeps try_lock failing for the whole second. + let deadline = Instant::now() + Duration::from_secs(1); + let outside = loop { + if LISTS.try_lock().is_ok() { + break true; + } + if Instant::now() >= deadline { + break false; + } + std::thread::yield_now(); + }; + (*probe).store(outside, Ordering::Release); } n as u32 }