1 extern crate ralloc; 2 3 #[global_allocator] 4 static ALLOCATOR: ralloc::Allocator = ralloc::Allocator; 5 6 mod util; 7 8 use std::thread; 9 10 fn make_thread() -> thread::JoinHandle<()> { 11 thread::spawn(|| { 12 let mut vec = Vec::new(); 13 14 for i in 0..0xFFF { 15 util::acid(|| { 16 vec.push(0); 17 vec[i] = i; 18 }); 19 } 20 21 for i in 0..0xFFF { 22 assert_eq!(vec[i], i); 23 } 24 }) 25 } 26 27 #[test] 28 #[ignore] 29 fn multithread_join_handle_vec() { 30 util::multiply(|| { 31 let mut join = Vec::new(); 32 33 for _ in 0..20 { 34 util::acid(|| { 35 join.push(make_thread()); 36 }); 37 } 38 39 for i in join { 40 i.join().unwrap(); 41 } 42 }); 43 } 44