]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/concurrency/libc_pthread_join_self.rs
Rollup merge of #102112 - cuviper:powerpc64-full-relro, r=eholk
[rust.git] / src / tools / miri / tests / fail / concurrency / libc_pthread_join_self.rs
1 //@ignore-target-windows: No libc on Windows
2 // We are making scheduler assumptions here.
3 //@compile-flags: -Zmiri-preemption-rate=0
4
5 // Joining itself is undefined behavior.
6
7 use std::{ptr, thread};
8
9 fn main() {
10     let handle = thread::spawn(|| {
11         unsafe {
12             let native: libc::pthread_t = libc::pthread_self();
13             assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0); //~ ERROR: Undefined Behavior: trying to join itself
14         }
15     });
16     thread::yield_now();
17     handle.join().unwrap();
18 }