2025-03-19 12:49:41 +01:00
|
|
|
// Regression test for https://github.com/rust-lang/rust/issues/138696
|
2025-03-27 14:11:11 +01:00
|
|
|
//@ only-unix
|
2025-03-27 08:46:35 +01:00
|
|
|
//@ needs-threads
|
2025-03-19 12:49:41 +01:00
|
|
|
//@ run-pass
|
|
|
|
|
|
|
|
|
|
#![feature(rustc_private)]
|
|
|
|
|
|
|
|
|
|
extern crate libc;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
std::thread::spawn(|| {
|
|
|
|
|
unsafe { libc::atexit(spawn_in_atexit) };
|
|
|
|
|
})
|
|
|
|
|
.join()
|
|
|
|
|
.unwrap();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern "C" fn spawn_in_atexit() {
|
|
|
|
|
std::thread::spawn(|| {
|
|
|
|
|
println!("Thread spawned in atexit");
|
|
|
|
|
})
|
|
|
|
|
.join()
|
|
|
|
|
.unwrap();
|
|
|
|
|
}
|