Documentation Home >> Headers >> <jss/experimental_future.hpp> Header >> std::experimental::packaged_task >> std::experimental::packaged_task::make_ready_at_thread_exit Member Function

Invoke the task associated with a std::experimental::packaged_task instance, and store the return value or exception in the associated asynchronous result without making the associated asynchronous result ready until thread exit.

void make_ready_at_thread_exit(ArgTypes... args);

Preconditions:

*this has an associated task.

Effects:

Invoke the associated task func as-if INVOKE(func,args...). If the invocation returns normally, store the return value in the asynchronous result associated with *this. If the invocation returns with an exception, store the exception in the asynchronous result associated with *this. Schedule the associated asynchronous state to be made ready when the current thread exits.

Postconditions:

The asynchronous result associated with *this has a stored value or exception, but is not ready until the current thread exits. Threads blocked waiting for the asynchronous result will be unblocked when the current thread exits.

Throws:

An exception of type std::future_error with an error code of std::future_errc::promise_already_satisfied if the asynchronous result already has a stored value or exception. An exception of type std::future_error with an error code of std::experimental::future_errc::no_state if *this has no associated asynchronous state.

Synchronization:

The completion of the thread that made a successful call to make_ready_at_thread_exit() happens-before a call to std::experimental::future<ResultType>::get() or std::experimental::shared_future<ResultType>::get() which retrieves the value or exception stored.

Header

#include <experimental/future>

See Also