use std::sync::{Mutex, Arc};
use std::thread;
fn main() {
let counter = Arc::new(Mutex::new(0));
let mut handles = vec![];
for _ in 0..10 {
let counter = Arc::clone(&counter);
let handle = thread::spawn(move || {
let mut num = counter.lock().unwrap();
*num += 1;
});
handles.push(handle);
}
for handle in handles {
handle.join().unwrap();
}
println!("Result: {}", *counter.lock().unwrap());
}
09-10
1344

05-03
109

05-02
173

05-02
280

05-02
93

04-27
429

04-18
289

04-11
222


2504d,12月会议
04-10
197


2025,倪五书的地址
04-01
166

03-28
247

03-26
98

03-25
207

03-20
118


2503d,d111更改
03-11
984

03-07
196


2503,D比C更易重构
03-04
340

02-26
238

02-22
196

02-13
172
