[futures.async] (original) (raw)
If launch::deferred is set in policy, stores decay-copy(std::forward<F>(f)) and_decay-copy_(std::forward<Args>(args))...in the shared state.
These copies of f and args constitute a deferred function.
Invocation of the deferred function evaluatesinvoke(std::move(g), std::move(xyz)) where g is the stored value of_decay-copy_(std::forward<F>(f)) and xyz is the stored copy of_decay-copy_(std::forward<Args>(args))....
Any return value is stored as the result in the shared state.
Any exception propagated from the execution of the deferred function is stored as the exceptional result in the shared state.
The shared state is not made ready until the function has completed.
The first call to a non-timed waiting function ([futures.state]) on an asynchronous return object referring to this shared state invokes the deferred function in the thread that called the waiting function.
Once evaluation of invoke(std::move(g), std::move(xyz)) begins, the function is no longer considered deferred.
Recommended practice: If this policy is specified together with other policies, such as when using apolicy value of launch::async | launch::deferred, implementations should defer invocation or the selection of the policy when no more concurrency can be effectively exploited.