Share via


promise::set_exception_at_thread_exit Method

Atomically sets the result of this promise to indicate an exception, delivering the notification only after all thread-local objects in the current thread have been destroyed (usually at thread exit).

void set_exception_at_thread_exit(exception_ptr Exc);

Parameters

  • Exc
    An exception_ptr that's stored by this method as the exception result.

Remarks

If the promise object has no associated asynchronous state, this method throws a future_error that has an error code of no_state.

If set_exception, set_exception_at_thread_exit, set_value, or set_value_at_thread_exit has already been called for a promise object that has the same associated asynchronous state, this method throws a future_error that has an error code of promise_already_satisfied.

In contrast to set_exception, this method does not set the associated asynchronous state to ready until after all thread-local objects in the current thread have been destroyed. Typically, threads that are blocked on the associated asynchronous state are not unblocked until the current thread exits.

Requirements

Header: future

Namespace: std

See Also

Reference

promise Class

<future>