1 //@only-target-windows: Uses win32 api functions
2 //@error-pattern: Undefined Behavior: trying to join a detached thread
4 // Joining a detached thread is undefined behavior.
6 use std::os::windows::io::{AsRawHandle, RawHandle};
10 fn CloseHandle(handle: RawHandle) -> u32;
14 let thread = thread::spawn(|| ());
17 assert_ne!(CloseHandle(thread.as_raw_handle()), 0);
20 thread.join().unwrap();