Add test.
This commit is contained in:
parent
f23e76e0d2
commit
5912dadf08
1 changed files with 22 additions and 0 deletions
22
tests/ui/thread-local/spawn-hook-atexit.rs
Normal file
22
tests/ui/thread-local/spawn-hook-atexit.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Regression test for https://github.com/rust-lang/rust/issues/138696
|
||||
//@ 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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue