std::packaged_task<R(Args...)>::make_ready_at_thread_exit - cppreference.com (original) (raw)

| void make_ready_at_thread_exit( ArgTypes... args ); | | (since C++11) | | ------------------------------------------------------- | | ------------- |

Calls the stored task as if by INVOKE(f, args...), where f is the stored task. The return value of the task or any exception thrown by it is stored in the shared state of *this.

The shared state is only made ready after the current thread exits and all objects of thread-local storage duration are destroyed.

[edit] Parameters

args - the parameters to pass on invocation of the stored task

[edit] Return value

(none)

[edit] Exceptions

std::future_error on the following error conditions:

[edit] Example

Output:

task: executed worker: future is not ready yet worker: exit main: worker finished main: future is ready

[edit] See also