|
- std::future - cppreference. com
The class template std::future provides a mechanism to access the result of asynchronous operations: An asynchronous operation (created via std::async, std::packaged_task, or std::promise) can provide a std::future object to the creator of that asynchronous operation The creator of the asynchronous operation can then use a variety of methods to query, wait for, or extract a value from the std
- std::future lt;T gt;::valid - cppreference. com
Checks if the future refers to a shared state This is the case only for futures that were not default-constructed or moved from (i e returned by std::promise::get_future (), std::packaged_task::get_future () or std::async ()) until the first time get () or share () is called
- std::promise lt;R gt;::set_exception - cppreference. com
Atomically stores the exception pointer p into the shared state and makes the state ready The operation behaves as though set_value, set_exception, set_value_at_thread_exit, and set_exception_at_thread_exit acquire a single mutex associated with the promise object while updating the promise object An exception is thrown if there is no shared state or the shared state already stores a value
- std::shared_future - cppreference. com
Unlike std::future, which is only moveable (so only one instance can refer to any particular asynchronous result), std::shared_future is copyable and multiple shared future objects may refer to the same shared state Access to the same shared state from multiple threads is safe if each thread does it through its own copy of a shared_future object
|
|
|