1266. shared_future::get and deferred async functions
Section: 33.10.8 [futures.shared.future] Status: Resolved
Submitter: Anthony Williams Opened: 2009-11-17 Last modified: 2021-06-06 18:38:24 UTC
Priority: Not Prioritized
View all other issues in [futures.shared.future].
View all issues with Resolved status.
If a shared_future is constructed with the result of an async call with a
deferred function, and two or more copies of that shared_future are created,
with multiple threads calling get(), it is not clear which thread runs the
deferred function. [futures.shared_future]p22 from
says (minus editor's note):
Effects: if the associated state contains a deferred function, executes
the deferred function. Otherwise, blocks until the associated state is ready.
In the absence of wording to the contrary, this implies that every thread that
calls wait() will execute the deferred function.
2010 Pittsburgh: Moved to
NAD Editorial. Rationale added below.
Replace [futures.shared_future]p22 with the following:
Effects: If the associated state
contains a deferred function, executes the deferred function. Otherwise,
blocks until the associated state is ready.