Store an exception in the asynchronous result associated with *this.
void set_exception(std::exception_ptr e);
- Preconditions:
*thishas an associated asynchronous result.(bool)eistrue.- Effects:
Store
ein the asynchronous result associated with*this.- Postconditions:
The asynchronous result associated with
*thisis ready with a stored exception. Any threads blocked waiting for the asynchronous result are unblocked.- Throws:
An exception of type
std::future_errorwith an error code ofstd::future_errc::promise_already_satisfiedif the asynchronous result already has a stored value or exception.- Synchronization:
Multiple concurrent calls to
set_value()andset_exception()are serialized. A successful call toset_exception()happens-before a call tostd::future<ResultType>::get()orstd::shared_future<ResultType>::get()which retrieves the exception stored.
Header
#include <future>