summaryrefslogtreecommitdiffstats
path: root/src/concurrent/qtaskbuilder.qdoc
diff options
context:
space:
mode:
authorVitaly Fanaskov <vitaly.fanaskov@qt.io>2020-03-11 18:07:03 +0100
committerVitaly Fanaskov <vitaly.fanaskov@qt.io>2020-03-29 20:44:32 +0100
commit5a0d4f3313157d2fe48e9d159968bed6883eb5f8 (patch)
treed7366ac16fdbe83ff4e8006577f9987404ae2742 /src/concurrent/qtaskbuilder.qdoc
parentd975ad4ed728553b765c61f38c1e0df899187cf5 (diff)
QtConcurrent: add fluent interface to configure a task before run
Task-number: QTBUG-82950 Change-Id: I449da938b6b501a7646b3425edde5c880d6ca87e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
Diffstat (limited to 'src/concurrent/qtaskbuilder.qdoc')
-rw-r--r--src/concurrent/qtaskbuilder.qdoc82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/concurrent/qtaskbuilder.qdoc b/src/concurrent/qtaskbuilder.qdoc
new file mode 100644
index 0000000000..8352cae17a
--- /dev/null
+++ b/src/concurrent/qtaskbuilder.qdoc
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \class QtConcurrent::QTaskBuilder
+ \inmodule QtConcurrent
+ \brief The QTaskBuilder class is used for adjusting task parameters.
+ \since 6.0
+
+ \ingroup thread
+
+ It's not possible to create an object of this class manually. See
+ \l {Concurrent Task} for more details and usage examples.
+*/
+
+/*!
+ \fn template <class Task, class ...Args> [[nodiscard]] QFuture<InvokeResultType> QtConcurrent::QTaskBuilder<Task, Args...>::spawn()
+
+ Runs the task in a separate thread and returns a future object immediately.
+ This is a non-blocking call. The task might not start immediately.
+*/
+
+/*!
+ \fn template <class Task, class ...Args> template <class ...ExtraArgs> [[nodiscard]] QTaskBuilder<Task, ExtraArgs...> QtConcurrent::QTaskBuilder<Task, Args...>::withArguments(ExtraArgs &&...args)
+
+ Sets the arguments \a args the task will be invoked with. The code is ill-formed
+ (causes compilation errors) if:
+ \list
+ \li This function is invoked more than once.
+ \li The arguments count is zero.
+ \endlist
+*/
+
+/*!
+ \fn template <class Task, class ...Args> [[nodiscard]] QTaskBuilder<Task, Args...> &QtConcurrent::QTaskBuilder<Task, Args...>::onThreadPool(QThreadPool &newThreadPool)
+
+ Sets the thread pool \a newThreadPool that the task will be invoked on.
+*/
+
+/*!
+ \fn template <class Task, class ...Args> [[nodiscard]] QTaskBuilder<Task, Args...> &QtConcurrent::QTaskBuilder<Task, Args...>::withPriority(int newPriority)
+
+ Sets the priority \a newPriority that the task will be invoked with.
+*/
+
+/*!
+ \typedef InvokeResultType
+ \relates QtConcurrent::QTaskBuilder
+
+ The simplified definition of this type looks like this:
+ \code
+ template <class Task, class ...Args>
+ using InvokeResultType = std::invoke_result_t<std::decay_t<Task>, std::decay_t<Args>...>;
+ \endcode
+
+ The real implementation also contains a compile-time check for
+ whether the task can be invoked with the specified arguments or not.
+*/