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, joining main is not UB, but it will block a thread forever.
10 fn WaitForSingleObject(handle: isize, timeout: u32) -> u32;
13 const INFINITE: u32 = u32::MAX;
15 // XXX HACK: This is how miri represents the handle for thread 0.
16 // This value can be "legitimately" obtained by using `GetCurrentThread` with `DuplicateHandle`
17 // but miri does not implement `DuplicateHandle` yet.
18 const MAIN_THREAD: isize = (2i32 << 30) as isize;
23 assert_eq!(WaitForSingleObject(MAIN_THREAD, INFINITE), 0); //~ ERROR: deadlock: the evaluated program deadlocked