blob: f75f306e5a631ccff55fba6cc664d497b144e035 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
//@ignore-target: windows # No pthreads on Windows
// We are making scheduler assumptions here.
//@compile-flags: -Zmiri-deterministic-concurrency
// Joining itself is undefined behavior.
use std::{ptr, thread};
fn main() {
let handle = thread::spawn(|| {
unsafe {
let native: libc::pthread_t = libc::pthread_self();
assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0); //~ ERROR: Undefined Behavior: trying to join itself
}
});
thread::yield_now();
handle.join().unwrap();
}
|