1 //! This test is a more subtle one. It is one which can hit thread destructors unexpectedly. 2 3 extern crate ralloc; 4 5 use std::sync::Arc; 6 use std::thread; 7 8 fn main() { 9 let numbers: Vec<_> = (0..100).collect(); 10 let shared_numbers = Arc::new(numbers); 11 12 for _ in 0..10 { 13 let child_numbers = shared_numbers.clone(); 14 15 thread::spawn(move || { 16 let local_numbers = &child_numbers[..]; 17 18 // Work with the local numbers 19 }); 20 } 21 } 22