We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8e9f7bc commit 8f51622Copy full SHA for 8f51622
tests/ui/thread-local/spawned-thread-dtor.rs
@@ -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
tests/ui/thread-local/spawned-thread-dtor.rs.stdout
@@ -0,0 +1 @@
+Foo dtor
0 commit comments