Skip to content

clarify the semantics of core::task::Waker::wake() #93961

Description

@rkuhn

Based on reading e.g. the Tokio sources and knowledge passed down from async monks to novices, I assume that calling cx.waker().wake_by_ref() from the task that is currently being polled will ensure that the task is polled again soon, even if no external reason arises. However, this behaviour is not documented, at least not unambiguously — the documentation for core::future::Future only states that the waker provided by the context can be used to wake up the task, which may technically require the task to be “sleeping” for this to have an effect.

If there is consensus that wake_by_ref will always and unconditionally ensure one further call to poll, then we should document this expectation as part of the Future contract. Who agrees? Anyone against? Am I missing something?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions