2020-06-28 04:31:34 -05:00
|
|
|
// ignore-windows: No libc on Windows
|
2022-06-06 16:44:16 -05:00
|
|
|
// We are making scheduler assumptions here.
|
|
|
|
// compile-flags: -Zmiri-preemption-rate=0
|
2020-04-19 18:42:58 -05:00
|
|
|
|
|
|
|
// Joining itself is undefined behavior.
|
|
|
|
|
|
|
|
#![feature(rustc_private)]
|
|
|
|
|
|
|
|
extern crate libc;
|
|
|
|
|
2020-04-20 15:22:28 -05:00
|
|
|
use std::{ptr, thread};
|
2020-04-19 18:42:58 -05:00
|
|
|
|
|
|
|
fn main() {
|
2020-04-20 15:22:28 -05:00
|
|
|
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();
|
2020-04-19 18:42:58 -05:00
|
|
|
}
|