Skip to content

Commit 0954d4c

Browse files
authored
Update wake.rs
1 parent a0ecf25 commit 0954d4c

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

library/core/src/task/wake.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -418,28 +418,21 @@ unsafe impl Sync for Waker {}
418418
impl Waker {
419419
/// Wakes up the task associated with this `Waker`.
420420
///
421-
/// As long as the executor keeps running and the task is not finished, it is
422-
/// guaranteed that each invocation of [`wake()`](Self::wake) (or
421+
/// As long as the executor keeps running and the task is not finished,
422+
/// it is guaranteed that each invocation of [`wake()`](Self::wake) (or
423423
/// [`wake_by_ref()`](Self::wake_by_ref)) will be followed by at least one
424-
/// [`poll()`] of the task to which this `Waker` belongs. This makes
425-
/// it possible to temporarily yield to other tasks while running potentially
426-
/// unbounded processing loops.
424+
/// [`poll()`] of the task to which this `Waker` belongs, and the call to
425+
/// [`wake()`](Self::wake) (or [`wake_by_ref()`](Self::wake_by_ref)) _happens-before_
426+
/// the beginning of the invocation of [`poll()`]. This makes it possible to temporarily
427+
/// yield to other tasks while running potentially unbounded processing loops.
427428
///
428429
/// Note that the above implies that multiple wake-ups may be coalesced into a
429-
/// single [`poll()`] invocation by the runtime.
430+
/// single [`poll()`] invocation by the executor.
430431
///
431432
/// Also note that yielding to competing tasks is not guaranteed: it is the
432433
/// executor’s choice which task to run and the executor may choose to run the
433434
/// current task again.
434435
///
435-
/// To avoid missed wakeups, executors must ensure that for any call to
436-
/// `wake`, there is a subsequent call to `poll` such that the call to
437-
/// `wake()` _happens-before_ the beginning of the invocation of `poll`. In
438-
/// particular, this means that if a task self-wakes (invokes `wake` on
439-
/// itself during `poll`), then the `poll` must be invoked again because the
440-
/// call to `wake` _happens-after_ the beginning of the current invocation
441-
/// of `poll`.
442-
///
443436
/// [`poll()`]: crate::future::Future::poll
444437
#[inline]
445438
#[stable(feature = "futures_api", since = "1.36.0")]

0 commit comments

Comments
 (0)