Skip to content

std::future: Document that each Future (Stream, etc) must only be used by one task at a time #66709

@sdroege

Description

@sdroege

See snapview/tokio-tungstenite#68 (comment) for context.

I couldn't find anything in the docs about this (maybe I just missed it), but current futures executors / async runtimes only allow remembering one waker per future/etc. So if you use the same in multiple tasks, one of the tasks would potentially never be woken up.

Allowing only one makes sense for performance reasons, so seems like a good idea.

This should be documented somewhere to make this constraint clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-async-awaitArea: Async & AwaitA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions