use std::thread;
use std::sync::{Arc, Mutex};
fn main() {
let vec: Vec<i32> = vec!(1, 2, 3);
let shared = Arc::new(Mutex::new(vec));
let clone = shared.clone();
let join_handle = thread::spawn(move || {
// Why can't we try here?
let mut data = clone.lock().unwrap();
data.push(5);
});
// TODO: why we can't we use try! here?
// JoinHandle's join() return value seems to be a different 'type' of Result.
join_handle.join().unwrap();
let clone = shared.clone();