Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtaskbuilder.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\class QtConcurrent::QTaskBuilder
6
\inmodule QtConcurrent
7
\brief The QTaskBuilder class is used for adjusting task parameters.
8
\since 6.0
9
10
\ingroup thread
11
12
The template parameter \a Task specifies the callable type, and \a Args
13
specifies the argument types that the task will be invoked with.
14
15
It's not possible to create an object of this class manually. See
16
\l {Concurrent Task} for more details and usage examples.
17
*/
18
19
/*!
20
\fn template <class Task, class ...Args> [[nodiscard]] QFuture<InvokeResultType> QtConcurrent::QTaskBuilder<Task, Args...>::spawn()
21
22
Runs the task in a separate thread and returns a future object immediately.
23
This is a non-blocking call. The task might not start immediately.
24
*/
25
26
/*!
27
\fn template <class Task, class ...Args> void QtConcurrent::QTaskBuilder<Task, Args...>::spawn(QtConcurrent::FutureResult)
28
29
Runs the task in a separate thread. This is a non-blocking call.
30
The task might not start immediately.
31
*/
32
33
/*!
34
\fn template <class Task, class ...Args> template <class ...ExtraArgs> [[nodiscard]] QTaskBuilder<Task, ExtraArgs...> QtConcurrent::QTaskBuilder<Task, Args...>::withArguments(ExtraArgs &&...args)
35
36
Sets the arguments \a args the task will be invoked with. The code is ill-formed
37
(causes compilation errors) if:
38
\list
39
\li This function is invoked more than once.
40
\li The arguments count is zero.
41
\endlist
42
*/
43
44
/*!
45
\fn template <class Task, class ...Args> [[nodiscard]] QTaskBuilder<Task, Args...> &QtConcurrent::QTaskBuilder<Task, Args...>::onThreadPool(QThreadPool &newThreadPool)
46
47
Sets the thread pool \a newThreadPool that the task will be invoked on.
48
*/
49
50
/*!
51
\fn template <class Task, class ...Args> [[nodiscard]] QTaskBuilder<Task, Args...> &QtConcurrent::QTaskBuilder<Task, Args...>::withPriority(int newPriority)
52
53
Sets the priority \a newPriority that the task will be invoked with.
54
*/
55
56
/*!
57
\typedef QtConcurrent::InvokeResultType
58
\relates QtConcurrent::QTaskBuilder
59
60
The simplified definition of this type looks like this:
61
\code
62
template <class Task, class ...Args>
63
using InvokeResultType = std::invoke_result_t<std::decay_t<Task>, std::decay_t<Args>...>;
64
\endcode
65
66
The real implementation also contains a compile-time check for
67
whether the task can be invoked with the specified arguments or not.
68
*/
69
70
/*!
71
\enum QtConcurrent::FutureResult
72
73
This enum type is used to invoke a special overload of
74
QtConcurrent::QTaskBuilder::spawn(QtConcurrent::FutureResult)
75
that doesn't return a future object.
76
77
\value Ignore
78
An auxiliary tag which introduced to improve code
79
readability.
80
*/
qtbase
src
concurrent
qtaskbuilder.qdoc
Generated on
for Qt by
1.16.1