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

2008. Conflicting Error Conditions for packaged_task::operator()

Section: 33.10.10.2 [futures.task.members] Status: C++11 Submitter: Pete Becker Opened: 2010-06-21 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [futures.task.members].

View all issues with C++11 status.

Discussion:

The Throws clause for packaged_task::operator() says that it throws "a future_error exception object if there is no associated asynchronous state or the stored task has already been invoked." However, the Error Conditions clause does not define an error condition when the stored task has already been invoked, only when the associated state is already ready (i.e. the invocation has completed).

[2011-02-17 Anthony provides an alternative resolution]

Previous proposed resolution:

Change the first bullet item in 33.10.10.2 [futures.task.members] /22:

void operator()(ArgTypes... args);

20 ...

21 ...

22 Error conditions:

[Adopted at Madrid, 2011-03]

Proposed resolution:

  1. Change the first bullet item in 33.10.10.2 [futures.task.members] p. 17:

    void operator()(ArgTypes... args);
    

    15 ...

    16 ...

    17 Error conditions:

    • promise_already_satisfied if the associated asynchronous state is already readystored task has already been invoked.
    • no_state if *this has no associated asynchronous state.
  2. Change the first bullet item in 33.10.10.2 [futures.task.members] p. 21:

    void make_ready_at_thread_exit(ArgTypes... args);
    

    19 ...

    20 ...

    21 Error conditions:

    • promise_already_satisfied if the associated asynchronous state already has a stored value or exceptionstored task has already been invoked.
    • no_state if *this has no associated asynchronous state.