B:BD[
3.306] → [
3.306:397]
B:BD[
3.460] → [
3.460:647]
let mutex_clone = mutex.clone();
let thread = thread::spawn(move || loop {
let state = mutex_clone.lock().unwrap().get();
match state {
State::Empty => thread::park(),
State::Wait(duration) => thread::sleep(duration),
State::Ready(data) => f(data),
let thread = thread::spawn({
let mutex = mutex.clone();
move || loop {
let state = mutex.lock().unwrap().get();
match state {
State::Empty => thread::park(),
State::Wait(duration) => thread::sleep(duration),
State::Ready(data) => f(data),
}