1 //@only-target-windows: Uses win32 api functions
2 // We are making scheduler assumptions here.
3 //@compile-flags: -Zmiri-preemption-rate=0
5 // On windows, a thread joining itself is not UB, but it will deadlock.
10 fn GetCurrentThread() -> usize;
11 fn WaitForSingleObject(handle: usize, timeout: u32) -> u32;
14 const INFINITE: u32 = u32::MAX;
19 let native = GetCurrentThread();
20 assert_eq!(WaitForSingleObject(native, INFINITE), 0); //~ ERROR: deadlock: the evaluated program deadlocked