update thread.md about reference

pull/1176/head
sunface 2 years ago
parent e451fd2028
commit a3b55a59a5

@ -447,14 +447,14 @@ fn main() {
let pair2 = pair.clone();
thread::spawn(move|| {
let &(ref lock, ref cvar) = &*pair2;
let (lock, cvar) = &*pair2;
let mut started = lock.lock().unwrap();
println!("changing started");
*started = true;
cvar.notify_one();
});
let &(ref lock, ref cvar) = &*pair;
let (lock, cvar) = &*pair;
let mut started = lock.lock().unwrap();
while !*started {
started = cvar.wait(started).unwrap();

Loading…
Cancel
Save