std::shared_future::valid member function
Checks if an std::shared_future instance is associated with an asynchronous result.
- Declaration
bool valid() const noexcept;
- Returns true if *this has an associated asynchronous result, false otherwise.
- Throws Nothing.
std::shared_future::wait member function
If the state associated with *this contains a deferred function, invokes the deferred function. Otherwise, waits until the asynchronous result associated with an instance of std::shared_future is ready.
- Declaration
void wait() const;
- Preconditions this->valid() would return true.
- Effects Calls to get() and wait() from multiple threads on std::shared_future instances that share the same associated state are serialized. If ...
Get C++ Concurrency in Action, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.