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 }