Skip to content

Commit 5adbbbc

Browse files
committed
Add test for process exit initiated by thread
1 parent ddec4b4 commit 5adbbbc

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//! Ensure that TLS destructors run on a spawned thread that
2+
//! exits the process.
3+
//@ run-pass
4+
//@ needs-threads
5+
//@ check-run-results
6+
7+
struct Foo;
8+
9+
impl Drop for Foo {
10+
fn drop(&mut self) {
11+
println!("Foo dtor");
12+
}
13+
}
14+
15+
thread_local!(static FOO: Foo = Foo);
16+
17+
fn main() {
18+
std::thread::spawn(|| {
19+
FOO.with(|_| {});
20+
std::process::exit(0);
21+
});
22+
23+
loop {
24+
std::thread::park();
25+
}
26+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Foo dtor

0 commit comments

Comments
 (0)