std::future: Document that each Future (Stream, etc) must only be used by one task at a time #66709
Labels
A-async-await
Area: Async & Await
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
AsyncAwait-Triaged
Async-await issues that have been triaged during a working group meeting.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
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.
The text was updated successfully, but these errors were encountered: