Skip to content

Commit f52ebaa

Browse files
authored
document expectations for Waker::wake
fixes #93961
1 parent 1f4681a commit f52ebaa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/core/src/task/wake.rs

+7
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,13 @@ unsafe impl Sync for Waker {}
219219

220220
impl Waker {
221221
/// Wake up the task associated with this `Waker`.
222+
///
223+
/// Multiple wake-ups (through clones of this `Waker` or `wake_by_ref`) may be
224+
/// coalesced into a single `poll` invocation by the runtime, and as long as
225+
/// the runtime keeps running and the task is not finished it is expected that
226+
/// each wake-up is followed by an invocation of `poll`, even in the absence of
227+
/// other events. This makes it possible to yield to other tasks when running
228+
/// potentially unbounded processing loops in order to maintain fairness.
222229
#[inline]
223230
#[stable(feature = "futures_api", since = "1.36.0")]
224231
pub fn wake(self) {

0 commit comments

Comments
 (0)