std::future_status
std::future_status
Defined in header <future>
- 定义于头文件 <future>
1. std::future_status
enum class future_status;
since C++11
enum class future_status {
ready,
timeout,
deferred
};
Specifies state of a future
as returned by wait_for
and wait_until
functions of std::future
and std::shared_future
.
指定 std::future
和 std::shared_future
的 wait_for
和 wait_until
函数所返回的 future
状态。
Return value for timed future
operations - 定时 future
操作的返回值
This enum class
type defines the possible return values of the wait_for
and wait_until
member functions of future
and shared_future
.
这种枚举类类型定义了 future
and shared_future
的 wait_for
and wait_until
成员函数的可能返回值。
future_status label | int value | description |
---|---|---|
future_status::ready |
0 | The function returned because the shared state was ready. - 共享状态就绪。 |
future_status::timeout |
1 | The function returned because the specified time was exhausted. - 共享状态在经过指定的时限时长前仍未就绪。 |
future_status::deferred |
2 | The function returned because the shared state contains a deferred function (see std::async ). -共享状态含有延迟的函数,故将仅在显式请求时计算结果。 |
References
http://www.cplusplus.com/reference/future/future_status/
https://en.cppreference.com/w/cpp/thread/future_status