- Qt 6.9
- Qt Core
- QtFuture Namespace
- Qt 6.9.2 Reference Documentation

# QtFuture Namespace

Contains miscellaneous identifiers used by the QFuture class. More...

Header: | `#include <QFuture>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Core)` `target_link_libraries(mytarget PRIVATE Qt6::Core)`
qmake: | `QT += core`

## Classes

`(since 6.3)` struct | WhenAnyResult

## Types

`(since 6.0)` enum class | Launch { Sync, Async, Inherit }

## Detailed Description

## Classes

### class WhenAnyResult

QtFuture::WhenAnyResult is used to represent the result of QtFuture::whenAny(). More...

## Type Documentation

### `[since 6.0]` enum class QtFuture::Launch

Represents execution policies for running a QFuture continuation.

Constant | Value | Description
--- | --- | ---
`QtFuture::Launch::Sync` | `0` | The continuation will be launched in the same thread that fulfills the promise associated with the future to which the continuation was attached, or if it has already finished, the continuation will be invoked immediately, in the thread that executes `then()`.
`QtFuture::Launch::Async` | `1` | The continuation will be launched in a separate thread taken from the global QThreadPool.
`QtFuture::Launch::Inherit` | `2` | The continuation will inherit the launch policy or thread pool of the future to which it is attached.

`Sync` is used as a default launch policy.

This enum was introduced in Qt 6.0.

See also QFuture::then() and QThreadPool::globalInstance().