blob: 63e7eb113dd4f2fe82861d53f66ad28684ee6c94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
//@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();
}
|