Namespaces
Variants

std:: launch

From cppreference.net
Concurrency support library
Threads
(C++11)
(C++20)
this_thread namespace
(C++11)
(C++11)
Cooperative cancellation
Mutual exclusion
Generic lock management
Condition variables
(C++11)
Semaphores
Latches and Barriers
(C++20)
(C++20)
Futures
(C++11)
(C++11)
(C++11)
launch
(C++11)
Safe reclamation
Hazard pointers
Atomic types
(C++11)
(C++20)
Initialization of atomic types
(C++11) (deprecated in C++20)
(C++11) (deprecated in C++20)
Memory ordering
(C++11) (deprecated in C++26)
Free functions for atomic operations
Free functions for atomic flags
ヘッダーで定義 <future>
enum class launch : /* unspecified */ {

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

} ;
(C++11以降)

std::launch BitmaskType です。 std::async 関数によって実行されるタスクの起動ポリシーを指定します。

定数

以下の定数は個々のビットを表し、標準ライブラリによって定義されています:

列挙子 意味
async タスクは別のスレッドで実行され、場合によっては最初に作成・起動される
deferred タスクは結果が最初に要求されたときに呼び出し元スレッドで実行される(遅延評価)

さらに、実装は以下のことを許可されています:

  • タスク相互作用に対する制限を指定する追加のビットとビットマスクを定義し、それらを一部の起動ポリシーのサブセットに適用可能にし、
  • それらの追加ビットマスクを std::async の最初(デフォルト)のオーバーロードで有効化する。

不具合報告

以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。

DR Applied to Behavior as published Correct behavior
LWG 2102 C++11 std::launch は実装定義の型であった 実装定義ではない

関連項目

(C++11)
関数を非同期で(新しいスレッドで実行する可能性があり)実行し、結果を保持する std::future を返す
(関数テンプレート)