std::launch(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay bestie, this is std::launch(3) from the C++ Standard Libary β€” and the NAME line is literally std::launch - std::launch. No cap, that’s the whole vibe πŸ’….

πŸ¦‹ Synopsis πŸ¦‹

It’s defined in the header <future>, and here’s the synopsis exactly as the page shows it:

          Defined in header <future>
          enum class launch : /* unspecified */ {

              async =    /* unspecified */,
              deferred = /* unspecified */,        (since C++11)
              /* implementation-defined */

          };

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

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

  • std::launch::async β€” the task is executed on a different thread, potentially by creating and launching it first.
  • std::launch::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 of std::async.

πŸ’… Defect reports πŸ’…

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

  • DR LWG 2102 β€” applied to C++11; behavior as published: std::launch was an implementation-defined type; correct behavior: it is not implementation-defined.

🫢 See also 🫢

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

xoxo bestie πŸ’– source: http://cppreference.com β€’ version/date: 2024.06.10 β€’ page: std::launch(3) ✨🫢

πŸ“¦ where this page comes from