Partager via


packaged_task::make_ready_at_thread_exit Method

Calls the callable object that's stored in the associated asynchronous state and atomically stores the returned value.

void make_ready_at_thread_exit(ArgTypes... args);

Remarks

If the packaged_task object doesn't have an associated asynchronous state, this method throws a future_error that has an error code of no_state.

If this method or make_ready_at_thread_exit has already been called for a packaged_task object that has the same associated asynchronous state, the method throws a future_error that has an error code of promise_already_satisfied.

Otherwise, this operator calls INVOKE(fn, args..., Ty), where fn is the callable object that's stored in the associated asynchronous state. Any returned value is stored atomically as the returned result of the associated asynchronous state.

In contrast to packaged_task::operator() Operator, the associated asynchronous state is not set to ready until after all thread-local objects in the calling thread have been destroyed. Typically, threads that are blocked on the associated asynchronous state are not unblocked until the calling thread exits.

Requirements

Header: future

Namespace: std

See Also

Reference

packaged_task Class

<future>