Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::sync::Arc;
- use std::sync::Mutex;
- fn main() {
- let test = Arc::new(Mutex::new("test".to_string()));
- println!("{}", test.lock().unwrap());
- {
- let mut test2 = test.lock().unwrap();
- *test2 = "test2".to_string();
- }
- println!("{}", test.lock().unwrap());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement