1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2020 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the documentation of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:FDL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Free Documentation License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Free |
19 | ** Documentation License version 1.3 as published by the Free Software |
20 | ** Foundation and appearing in the file included in the packaging of |
21 | ** this file. Please review the following information to ensure |
22 | ** the GNU Free Documentation License version 1.3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. |
24 | ** $QT_END_LICENSE$ |
25 | ** |
26 | ****************************************************************************/ |
27 | |
28 | /*! |
29 | \class QtConcurrent::QTaskBuilder |
30 | \inmodule QtConcurrent |
31 | \brief The QTaskBuilder class is used for adjusting task parameters. |
32 | \since 6.0 |
33 | |
34 | \ingroup thread |
35 | |
36 | It's not possible to create an object of this class manually. See |
37 | \l {Concurrent Task} for more details and usage examples. |
38 | */ |
39 | |
40 | /*! |
41 | \fn template <class Task, class ...Args> [[nodiscard]] QFuture<InvokeResultType> QtConcurrent::QTaskBuilder<Task, Args...>::spawn() |
42 | |
43 | Runs the task in a separate thread and returns a future object immediately. |
44 | This is a non-blocking call. The task might not start immediately. |
45 | */ |
46 | |
47 | /*! |
48 | \fn template <class Task, class ...Args> void QtConcurrent::QTaskBuilder<Task, Args...>::spawn(QtConcurrent::FutureResult) |
49 | |
50 | Runs the task in a separate thread. This is a non-blocking call. |
51 | The task might not start immediately. |
52 | */ |
53 | |
54 | /*! |
55 | \fn template <class Task, class ...Args> template <class ...ExtraArgs> [[nodiscard]] QTaskBuilder<Task, ExtraArgs...> QtConcurrent::QTaskBuilder<Task, Args...>::withArguments(ExtraArgs &&...args) |
56 | |
57 | Sets the arguments \a args the task will be invoked with. The code is ill-formed |
58 | (causes compilation errors) if: |
59 | \list |
60 | \li This function is invoked more than once. |
61 | \li The arguments count is zero. |
62 | \endlist |
63 | */ |
64 | |
65 | /*! |
66 | \fn template <class Task, class ...Args> [[nodiscard]] QTaskBuilder<Task, Args...> &QtConcurrent::QTaskBuilder<Task, Args...>::onThreadPool(QThreadPool &newThreadPool) |
67 | |
68 | Sets the thread pool \a newThreadPool that the task will be invoked on. |
69 | */ |
70 | |
71 | /*! |
72 | \fn template <class Task, class ...Args> [[nodiscard]] QTaskBuilder<Task, Args...> &QtConcurrent::QTaskBuilder<Task, Args...>::withPriority(int newPriority) |
73 | |
74 | Sets the priority \a newPriority that the task will be invoked with. |
75 | */ |
76 | |
77 | /*! |
78 | \typedef InvokeResultType |
79 | \relates QtConcurrent::QTaskBuilder |
80 | |
81 | The simplified definition of this type looks like this: |
82 | \code |
83 | template <class Task, class ...Args> |
84 | using InvokeResultType = std::invoke_result_t<std::decay_t<Task>, std::decay_t<Args>...>; |
85 | \endcode |
86 | |
87 | The real implementation also contains a compile-time check for |
88 | whether the task can be invoked with the specified arguments or not. |
89 | */ |
90 | |
91 | /*! |
92 | \enum QtConcurrent::FutureResult |
93 | |
94 | This enum type is used to invoke a special overload of |
95 | QtConcurrent::QTaskBuilder::spawn(QtConcurrent::FutureResult) |
96 | that doesn't return a future object. |
97 | |
98 | \value Ignore |
99 | An auxiliary tag which introduced to improve code |
100 | readability. |
101 | */ |
102 | |