public member function


void make_ready_at_thread_exit (args... args);
Call stored task and make ready at thread exit
Calls the stored task, forwarding args as its arguments, just like calling its operator() member, but making the shared state ready at thread exit, instead of as soon as the call completes.

If a future object that is associated to the same shared state is waiting on a call to future::get, it stays blocked until the thread ends. Once the thread ends, the call to future::get unblocks and returns or throws an exception.

Notice that calling this function already sets the value in the shared state, and any call that attempts to modify this value between this call and the end of the thread will throw future_error with promise_already_satisfied as error condition.


Arguments for the call.
Args... are packaged_task's template parameters, which represent the types of the arguments for the stored task .

Return value


Data races

The packaged_task is modified.
The shared state is modified as an atomic operation (causing no data races), with synchronization happening at thread end.

Exception safety

Basic guarantee: if an exception is thrown, the packaged_task is in a valid state.

This member function throws an exception on the following conditions:
exception typeerror conditiondescription
future_errorfuture_errc::no_stateThe object has no shared state (it is a default-constructed packaged_task)
future_errorfuture_errc::promise_already_satisfiedThe stored task has already been called
This member function also throws if any copy or movement of the arguments throws and -depending on the library implementation- may also throw to report other situations.

See also