1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5 \class QtConcurrent::QTaskBuilder
7 \brief The QTaskBuilder class is used for adjusting task parameters.
12 It's not possible to create an object of this class manually. See
13 \l {Concurrent Task} for more details and usage examples.
17 \fn template <class Task, class ...Args> [[nodiscard]] QFuture<InvokeResultType> QtConcurrent::QTaskBuilder<Task, Args...>::spawn()
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.
24 \fn template <class Task, class ...Args> void QtConcurrent::QTaskBuilder<Task, Args...>::spawn(QtConcurrent::FutureResult)
26 Runs the task in a separate thread. This is a non-blocking call.
27 The task might not start immediately.
31 \fn template <class Task, class ...Args> template <class ...ExtraArgs> [[nodiscard]] QTaskBuilder<Task, ExtraArgs...> QtConcurrent::QTaskBuilder<Task, Args...>::withArguments(ExtraArgs &&...args)
33 Sets the arguments \a args the task will be invoked with. The code is ill-formed
34 (causes compilation errors) if:
36 \li This function is invoked more than once.
37 \li The arguments count is zero.
42 \fn template <class Task, class ...Args> [[nodiscard]] QTaskBuilder<Task, Args...> &QtConcurrent::QTaskBuilder<Task, Args...>::onThreadPool(QThreadPool &newThreadPool)
44 Sets the thread pool \a newThreadPool that the task will be invoked on.
48 \fn template <class Task, class ...Args> [[nodiscard]] QTaskBuilder<Task, Args...> &QtConcurrent::QTaskBuilder<Task, Args...>::withPriority(int newPriority)
50 Sets the priority \a newPriority that the task will be invoked with.
54 \typedef InvokeResultType
55 \relates QtConcurrent::QTaskBuilder
57 The simplified definition of this type looks like this:
59 template <class Task, class ...Args>
60 using InvokeResultType = std::invoke_result_t<std::decay_t<Task>, std::decay_t<Args>...>;
63 The real implementation also contains a compile-time check for
64 whether the task can be invoked with the specified arguments or not.
68 \enum QtConcurrent::FutureResult
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.
75 An auxiliary tag which introduced to improve code