File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -198,11 +198,10 @@ impl Condvar {
198198 /// the system time. This function is susceptible to spurious wakeups.
199199 /// Condition variables normally have a boolean predicate associated with
200200 /// them, and the predicate must always be checked each time this function
201- /// returns to protect against spurious wakeups. Additionally, it is
202- /// typically desirable for the timeout to not exceed some duration in
203- /// spite of spurious wakes, thus the sleep-duration is decremented by the
204- /// amount slept. Alternatively, use the `wait_timeout_while` method
205- /// to wait with a timeout while a predicate is true.
201+ /// returns to protect against spurious wakeups. Furthermore, since the timeout
202+ /// is given relative to the moment this function is called, it needs to be adjusted
203+ /// when this function is called in a loop. The [`wait_timeout_while`] method
204+ /// lets you wait with a timeout while a predicate is true, taking care of all these concerns.
206205 ///
207206 /// The returned [`WaitTimeoutResult`] value indicates if the timeout is
208207 /// known to have elapsed.
Original file line number Diff line number Diff line change @@ -269,11 +269,10 @@ impl Condvar {
269269 /// the system time. This function is susceptible to spurious wakeups.
270270 /// Condition variables normally have a boolean predicate associated with
271271 /// them, and the predicate must always be checked each time this function
272- /// returns to protect against spurious wakeups. Additionally, it is
273- /// typically desirable for the timeout to not exceed some duration in
274- /// spite of spurious wakes, thus the sleep-duration is decremented by the
275- /// amount slept. Alternatively, use the `wait_timeout_while` method
276- /// to wait with a timeout while a predicate is true.
272+ /// returns to protect against spurious wakeups. Furthermore, since the timeout
273+ /// is given relative to the moment this function is called, it needs to be adjusted
274+ /// when this function is called in a loop. The [`wait_timeout_while`] method
275+ /// lets you wait with a timeout while a predicate is true, taking care of all these concerns.
277276 ///
278277 /// The returned [`WaitTimeoutResult`] value indicates if the timeout is
279278 /// known to have elapsed.
You can’t perform that action at this time.
0 commit comments