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.

ConstantValueDescription
QtFuture::Launch::Sync0The 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::Async1The continuation will be launched in a separate thread taken from the global QThreadPool.
QtFuture::Launch::Inherit2The 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().