This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.

2078. Throw specification of async() incomplete

Section: 33.10.9 [futures.async] Status: C++14 Submitter: Nicolai Josuttis Opened: 2011-08-29 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [futures.async].

View all other issues in [futures.async].

View all issues with C++14 status.

Discussion:

The current throw specification of async() does state:

-6- Throws: system_error if policy is launch::async and the implementation is unable to start a new thread.

First it seems not clear whether this only applies if policy equals launch::async of if the async launch mode flag is set (if policy|launch::async!=0)

In the discussion Lawrence Crowl also wrote:

More generally, I think what we want to say is that if the implementation cannot successfully execute on one of the policies allowed, then it must choose another. The principle would apply to implementation-defined policies as well.

Peter Sommerlad:

Should not throw. That was the intent. "is async" meat exactly.

[2012, Portland: move to Tentatively NAD Editorial]

If no launch policy, it is undefined behavior.

Agree with Lawrence, should try all the allowed policies. We will rephrase so that the policy argument should be lauch::async. Current wording seems good enough.

We believe this choice of policy statement is really an editorial issue.

[2013-09 Chicago]

If all the implementors read it and can't get it right - it is not editorial. Nico to provide wording

No objections to revised wording, so moved to Immediate.

Accept for Working Paper

Proposed resolution:

This wording is relative to N3691.

  1. Change 33.10.9 [futures.async] p6, p7 as indicated:

    -6- Throws: system_error if policy is == launch::async and the implementation is unable to start a new thread.

    -7- Error conditions:

    • resource_unavailable_try_again — if policy is == launch::async and the system is unable to start a new thread.