public member function
<future>

std::shared_future::wait

void wait() const;
Wait for ready
Waits for the shared state to be 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).

引數



返回值



資料競爭

shared_future 物件被訪問。
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.

異常安全

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).

另見