improve wording of Waker::wake documentation

This commit is contained in:
Roland Kuhn 2022-02-20 12:23:26 +01:00 committed by GitHub
parent f52ebaa45d
commit 2946f7aad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -220,12 +220,14 @@ unsafe impl Sync for Waker {}
impl Waker { impl Waker {
/// Wake up the task associated with this `Waker`. /// Wake up the task associated with this `Waker`.
/// ///
/// Multiple wake-ups (through clones of this `Waker` or `wake_by_ref`) may be /// As long as the runtime keeps running and the task is not finished, it is
/// coalesced into a single `poll` invocation by the runtime, and as long as /// guaranteed that each invocation of `wake` (or `wake_by_ref`) will be followed
/// the runtime keeps running and the task is not finished it is expected that /// by at least one `poll` of the task to which this `Waker` belongs. This makes
/// each wake-up is followed by an invocation of `poll`, even in the absence of /// it possible to temporarily yield to other tasks while running potentially
/// other events. This makes it possible to yield to other tasks when running /// unbounded processing loops.
/// potentially unbounded processing loops in order to maintain fairness. ///
/// Note that the above implies that multiple wake-ups may be coalesced into a
/// single `poll` invocation by the runtime.
#[inline] #[inline]
#[stable(feature = "futures_api", since = "1.36.0")] #[stable(feature = "futures_api", since = "1.36.0")]
pub fn wake(self) { pub fn wake(self) {