blob: 0e9eb24459c3ef051f4b04e80eacc93bab13b2cf [file] [log] [blame]
//@only-target-windows: Uses win32 api functions
//@error-in-other-file: Undefined Behavior: trying to join a detached thread
// Joining a detached thread is undefined behavior.
use std::os::windows::io::AsRawHandle;
use std::thread;
use windows_sys::Win32::Foundation::{CloseHandle, HANDLE};
fn main() {
let thread = thread::spawn(|| ());
unsafe {
assert_ne!(CloseHandle(thread.as_raw_handle() as HANDLE), 0);
}
thread.join().unwrap();
}