std::launch
|
|
在标头
<future>
定义
|
||
enum
class
launch :
/*
unspecified */
{
async =
/*
unspecified
*/, |
(C++11 起) | |
指定 std::async
所指定的任务的的运行策略。 std::launch
是用作位掩码类型 (BitmaskType)
的枚举。
标准库定义下列代表单独位的常量:
常量 | 解释 |
std::launch::async
|
运行新线程,以异步执行任务 |
std::launch::deferred
|
调用方线程上首次请求其结果时执行任务(惰性求值) |
另外,允许实现:
- 定义额外的位和位掩码,以指定可应用于运行策略子集的任务交互上的限制,并
- 对 std::async 的首个(默认)重载启用这些额外位掩码。
参阅
(C++11)
|
异步运行一个函数(有可能在新线程中执行),并返回保有它的结果的 std::future
(函数模板) |