Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 It's not possible to create an object of this class manually. See
13 \l {Concurrent Task} for more details and usage examples.
14*/
15
16/*!
17 \fn template <class Task, class ...Args> [[nodiscard]] QFuture<InvokeResultType> QtConcurrent::QTaskBuilder<Task, Args...>::spawn()
18
19 Runs the task in a separate thread and returns a future object immediately.
20 This is a non-blocking call. The task might not start immediately.
21*/
22
23/*!
24 \fn template <class Task, class ...Args> void QtConcurrent::QTaskBuilder<Task, Args...>::spawn(QtConcurrent::FutureResult)
25
26 Runs the task in a separate thread. This is a non-blocking call.
27 The task might not start immediately.
28*/
29
30/*!
31 \fn template <class Task, class ...Args> template <class ...ExtraArgs> [[nodiscard]] QTaskBuilder<Task, ExtraArgs...> QtConcurrent::QTaskBuilder<Task, Args...>::withArguments(ExtraArgs &&...args)
32
33 Sets the arguments \a args the task will be invoked with. The code is ill-formed
34 (causes compilation errors) if:
35 \list
36 \li This function is invoked more than once.
37 \li The arguments count is zero.
38 \endlist
39*/
40
41/*!
42 \fn template <class Task, class ...Args> [[nodiscard]] QTaskBuilder<Task, Args...> &QtConcurrent::QTaskBuilder<Task, Args...>::onThreadPool(QThreadPool &newThreadPool)
43
44 Sets the thread pool \a newThreadPool that the task will be invoked on.
45*/
46
47/*!
48 \fn template <class Task, class ...Args> [[nodiscard]] QTaskBuilder<Task, Args...> &QtConcurrent::QTaskBuilder<Task, Args...>::withPriority(int newPriority)
49
50 Sets the priority \a newPriority that the task will be invoked with.
51*/
52
53/*!
54 \typedef QtConcurrent::InvokeResultType
55 \relates QtConcurrent::QTaskBuilder
56
57 The simplified definition of this type looks like this:
58 \code
59 template <class Task, class ...Args>
60 using InvokeResultType = std::invoke_result_t<std::decay_t<Task>, std::decay_t<Args>...>;
61 \endcode
62
63 The real implementation also contains a compile-time check for
64 whether the task can be invoked with the specified arguments or not.
65*/
66
67/*!
68 \enum QtConcurrent::FutureResult
69
70 This enum type is used to invoke a special overload of
71 QtConcurrent::QTaskBuilder::spawn(QtConcurrent::FutureResult)
72 that doesn't return a future object.
73
74 \value Ignore
75 An auxiliary tag which introduced to improve code
76 readability.
77*/