Title
Incomplete action on async/launch::deferred
Status
c++14
Section
[futures.async]
Submitter
Vicente J. Botet Escriba

Created on 2012-09-20.00:00:00 last changed 131 months ago

Messages

Date: 2014-02-14.19:48:07

[ This wording is relative to N3376. ]

  1. Change [futures.async] p3 bullet 2 as indicated:

    template <class F, class... Args>
    future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
    async(F&& f, Args&&... args);
    template <class F, class... Args>
    future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
    async(launch policy, F&& f, Args&&... args);
    

    -2- Requires: […]

    -3- Effects:: The first function behaves the same as a call to the second function with a policy argument of launch::async | launch::deferred and the same arguments for F and Args. […] The further behavior of the second function depends on the policy argument as follows (if more than one of these conditions applies, the implementation may choose any of the corresponding policies):

    • if policy & launch::async is non-zero […]

    • if policy & launch::deferred is non-zero — 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 evaluates INVOKE(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 shall invoke 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. [Note: If this policy is specified together with other policies, such as when using a policy value of launch::async | launch::deferred, implementations should defer invocation or the selection of the policy when no more concurrency can be effectively exploited. — end note]

Date: 2014-02-14.19:48:07

[ Issaquah 2014-02-11: Move to Immediate after SG1 review ]

Date: 2012-11-02.22:48:46

[ 2012, Portland: move to Open ]

Detlef: agree with the problem but not with the resolution. The wording should be applied to all launch policies rather than having to be separately specified for each one.

Hans: we should redraft to factor out the proposed text outside the two bullets. Needs to be carefully worded to be compatible with the resolution of 2120 (see above).

Moved to open

Date: 2012-09-20.00:00:00

The description of the effects of async when the launch policy is launch::deferred doesn't state what is done with the result of the deferred function invocation and the possible exceptions as it is done for the asynchronous function when the policy is launch::async.

History
Date User Action Args
2014-02-27 17:03:20adminsetstatus: wp -> c++14
2014-02-20 13:52:38adminsetstatus: immediate -> wp
2014-02-14 19:48:07adminsetmessages: + msg6868
2014-02-14 19:48:07adminsetstatus: open -> immediate
2012-11-02 22:48:46adminsetmessages: + msg6256
2012-11-02 22:48:46adminsetstatus: new -> open
2012-09-23 21:39:13adminsetmessages: + msg6139
2012-09-20 00:00:00admincreate