在线文档教程
C++
线程支持 | Thread support

std::launch

STD:启动

Defined in header
enum class launch : /* unspecified */ { async = /* unspecified */, deferred = /* unspecified */, /* implementation-defined */ };(since C++11)

对象执行的任务的启动策略。std::async功能。std::launch是用作BitmaskType...

标准库定义了表示单个位的下列常量:

ConstantExplanation
std::launch::asynca new thread is launched to execute the task asynchronously
std::launch::deferredthe task is executed on the calling thread the first time its result is requested (lazy evaluation)

此外,还允许实现:

  • 定义额外的位位和位掩码,以指定适用于启动策略子集的任务交互的限制,以及

  • 为第一个%28默认%29重载启用这些额外的位掩码。std::async...

另见

async (C++11)runs a function asynchronously (potentially in a new thread) and returns a std::future that will hold the result (function template)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/线程/start