Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::thread;
- use std::sync::{Arc, Mutex};
- use std::collections::HashMap;
- fn main() {
- let resps = Arc::new(Mutex::new(HashMap::new()));
- let resps_inner = resps.clone();
- let resps_inner2 = resps.clone();
- thread::spawn(move || {
- let mut resps = resps_inner.lock().unwrap();
- resps.insert(1, 2);
- });
- thread::spawn(move || {
- let mut resps = resps_inner2.lock().unwrap();
- unimplemented!();
- });
- }
Add Comment
Please, Sign In to add comment