1266. shared_future::get and deferred async functions
Section: 33.6.8 [futures.shared_future] Status: Resolved
Submitter: Anthony Williams Opened: 2009-11-17 Last modified: 2016-02-10
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. 33.6.8 [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 33.6.8 [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.