Skip to content

Commit

Permalink
Rollup merge of rust-lang#93966 - rkuhn:patch-1, r=tmandry
Browse files Browse the repository at this point in the history
document expectations for Waker::wake

fixes rust-lang#93961

Opened PR for a discussion on the precise wording.
  • Loading branch information
JohnTitor authored May 24, 2022
2 parents 76761db + 3d808d5 commit 33f45b1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions library/core/src/task/wake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,19 @@ unsafe impl Sync for Waker {}

impl Waker {
/// Wake up the task associated with this `Waker`.
///
/// As long as the runtime keeps running and the task is not finished, it is
/// guaranteed that each invocation of `wake` (or `wake_by_ref`) will be followed
/// by at least one `poll` of the task to which this `Waker` belongs. This makes
/// it possible to temporarily yield to other tasks while running potentially
/// unbounded processing loops.
///
/// Note that the above implies that multiple wake-ups may be coalesced into a
/// single `poll` invocation by the runtime.
///
/// Also note that yielding to competing tasks is not guaranteed: it is the
/// executor’s choice which task to run and the executor may choose to run the
/// current task again.
#[inline]
#[stable(feature = "futures_api", since = "1.36.0")]
pub fn wake(self) {
Expand Down

0 comments on commit 33f45b1

Please sign in to comment.