This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
Section: 99 [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. 99 [futures.shared_future]p22 from N3000 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.
Solved by N3058.
Replace 99 [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.