Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::launch

      From cppreference.com
      <cpp‎ |thread
       
       
      Concurrency support library
      Threads
      (C++11)
      (C++20)
      this_thread namespace
      (C++11)
      (C++11)
      (C++11)
      Cooperative cancellation
      Mutual exclusion
      Generic lock management
      (C++11)
      (C++11)
      (C++11)
      (C++11)
      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
       
      Defined in header<future>
      enumclass launch:/* unspecified */{

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

      };
      (since C++11)

      std::launch is aBitmaskType. It specifies the launch policy for a task executed by thestd::async function.

      [edit]Constants

      The following constants denoting individual bits are defined by the standard library:

      Enumerator Meaning
      async the task is executed on a different thread, potentially by creating and launching it first
      deferred the task is executed on the calling thread the first time its result is requested (lazy evaluation)

      In addition, implementations are allowed to:

      • define additional bits and bitmasks to specify restrictions on task interactions applicable to a subset of launch policies, and
      • enable those additional bitmasks for the first (default) overload ofstd::async.

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 2102C++11std::launch was an implementation-defined typeit is not implementation-defined

      [edit]See also

      (C++11)
      runs a function asynchronously (potentially in a new thread) and returns astd::future that will hold the result
      (function template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/thread/launch&oldid=182080"

      [8]ページ先頭

      ©2009-2025 Movatter.jp