Fix condvar example
This commit is contained in:
parent
16362c737f
commit
ba6a6d0f0a
1 changed files with 4 additions and 2 deletions
|
|
@ -47,11 +47,13 @@ impl WaitTimeoutResult {
|
|||
///
|
||||
/// thread::spawn(move|| {
|
||||
/// let &(ref lock, ref cvar) = &*pair2;
|
||||
///
|
||||
/// // Let's wait 20 milliseconds before notifying the condvar.
|
||||
/// thread::sleep(Duration::from_millis(20));
|
||||
///
|
||||
/// let mut started = lock.lock().unwrap();
|
||||
/// // We update the boolean value.
|
||||
/// *started = true;
|
||||
/// // Let's wait 20 milliseconds before notifying the condvar.
|
||||
/// thread::sleep(Duration::from_millis(20));
|
||||
/// cvar.notify_one();
|
||||
/// });
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue