public member function
<future>

std::shared_future::wait

void wait() const;
Wait for ready
Waits for the shared state to be ready.

If the shared state is not yet ready (i.e., the provider has not yet set its value or exception), the function blocks the calling thread and waits until it is ready.

Once the shared state is ready, the function unblocks and returns without reading its value nor throwing its set exception (if any).

All visible side effects are synchronized between the point the provider makes the shared state ready and the return of this function, but note that no synchronization exists among the potential multiple functions returning on this event (in case of multiple shared_future objects were waiting for the same shared state).

Parameters

none

Return value

none

Data races

The shared_future object is accessed.
The shared state is accessed as an atomic operation relative to the previous modifying operation by the provider, but not in relation to multiple accesses from shared_future objects.

Exception safety

Calling this member function on a shared_future object that is not valid, produces undefined behavior (although library implementations may detect this and throw future_error with a no_state error condition).

See also