We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66aa3d0 commit 78bcd12Copy full SHA for 78bcd12
tests/run-pass/threadleak_ignored.rs
@@ -18,9 +18,20 @@ thread_local! {
18
19
fn main() {
20
X.with(|x| *x.borrow_mut() = Some(LoudDrop(0)));
21
+
22
+ // Set up a channel so that we can learn when the other thread initialized `X`
23
+ // (so that we are sure there is something to drop).
24
+ let (send, recv) = std::sync::mpsc::channel::<()>();
25
- let _detached = std::thread::spawn(|| {
26
+ let _detached = std::thread::spawn(move || {
27
X.with(|x| *x.borrow_mut() = Some(LoudDrop(1)));
28
+ send.send(()).unwrap();
29
+ std::thread::yield_now();
30
loop {}
31
});
32
33
34
35
+ // Wait until child thread has initialized its `X`.
36
+ let () = recv.recv().unwrap();
37
}
0 commit comments