diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2025-03-19 12:49:41 +0100 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2025-03-19 12:50:47 +0100 |
| commit | 5912dadf08fa2b29f723ec2c2b2315399a75c06e (patch) | |
| tree | 3fddfe767602f69a55ae622b77909c6a0837c389 | |
| parent | f23e76e0d273b2c7612421b2d8505f84c9ea480f (diff) | |
| download | rust-5912dadf08fa2b29f723ec2c2b2315399a75c06e.tar.gz rust-5912dadf08fa2b29f723ec2c2b2315399a75c06e.zip | |
Add test.
| -rw-r--r-- | tests/ui/thread-local/spawn-hook-atexit.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/thread-local/spawn-hook-atexit.rs b/tests/ui/thread-local/spawn-hook-atexit.rs new file mode 100644 index 00000000000..cc517e8fa4c --- /dev/null +++ b/tests/ui/thread-local/spawn-hook-atexit.rs @@ -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(); +} |
