Skip to content

Commit

Permalink
Adjust doc comment of Condvar::wait_while
Browse files Browse the repository at this point in the history
The existing phrasing implies that a notification must be received for `wait_while` to return. The phrasing is changed to better reflect the behavior.
  • Loading branch information
rawler committed Sep 6, 2024
1 parent d678b81 commit 0fb0680
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions library/std/src/sync/condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,12 @@ impl Condvar {
if poisoned { Err(PoisonError::new(guard)) } else { Ok(guard) }
}

/// Blocks the current thread until this condition variable receives a
/// notification and the provided condition is false.
/// Blocks the current thread while the provided condition stops returning
/// `true`
///
/// `condition` is checked immediately; if not met (returns `true`), this
/// will [`wait`] for the next notification then check again. This repeats
/// until `condition` returns `false`, in which case this function returns.
///
/// This function will atomically unlock the mutex specified (represented by
/// `guard`) and block the current thread. This means that any calls
Expand All @@ -210,6 +214,7 @@ impl Condvar {
/// poisoned when this thread re-acquires the lock. For more information,
/// see information about [poisoning] on the [`Mutex`] type.
///
/// [`wait`]: Self::wait
/// [`notify_one`]: Self::notify_one
/// [`notify_all`]: Self::notify_all
/// [poisoning]: super::Mutex#poisoning
Expand Down

0 comments on commit 0fb0680

Please sign in to comment.