std::launch

定义于头文件 <future>
enum class launch : /* unspecified */ {

    async =    /* unspecified */,
    deferred = /* unspecified */,
    /* implementation-defined */

};
(C++11 起)

指定 std::async 所指定的任务的的运行策略。 std::launch 是用作位掩码类型 (BitmaskType) 的枚举。

标准库定义下列代表单独位的常量:

常量 解释
std::launch::async 运行新线程,以异步执行任务
std::launch::deferred 调用方线程上首次请求其结果时执行任务(惰性求值)

另外,允许实现:

参阅

(C++11)
异步运行函数(有可能在新线程中)并返回保有结果的 std::future
(函数模板)

版本历史

  • (当前 | 先前 2017年9月24日 (日) 08:54Fruderica讨论 | 贡献 . . (1,004字节) (-6). . (wording) (撤销)
  • 当前 | 先前 2017年8月26日 (六) 09:26Fruderica讨论 | 贡献. . (1,010字节) (-1,014). . (撤销)
  • 当前 | 先前 2013年7月2日 (二) 11:32P12bot讨论 | 贡献 . . (2,024字节) (-56). . (Use {{lc}}. Update links. Various fixes.) (撤销)
  • 当前 | 先前 2012年11月2日 (五) 19:48P12bot讨论 | 贡献 . . (2,080字节) (+201). . (r2.7.3) (机器人添加:de, en, es, fr, it, ja, pt, ru) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 03:08P12讨论 | 贡献 . . (1,879字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前) 2012年10月25日 (四) 12:00TranslationBot讨论 | 贡献. . (1,879字节) (+1,879). . (Translated from the English version using Google Translate)