Details
-
User Story
-
Resolution: Done
-
P2: Important
-
6.0
-
None
-
-
13
-
Qt6_Foundation_ Sprint 5
-
5a0d4f3313157d2fe48e9d159968bed6883eb5f8
Description
QtConcurrent::run provides an API for running a callable object in a separate thread. This functionality is represented by a few functions with different signatures. One of the functions allows a user to specify a thread pool on which the task should be executed.
There are a few requests from Qt users regarding adding more parameters to the API. For example, set a priority for a task.
Adding more parameters leads to increasing API complexity. Furthermore, some of parameters are not mandatory. For example, it should be possible to set a priority for a task, but not specify a thread pool.
In light of this, it would be nice to have a fluent interface for adjusting some related parameters. It should also improve code readability.
Example of a such interface (all calls between "task" and "spawn" are optional):
QtConcurrent::task(doSmth)
.withArguments(1, 2, 3)
.onThreadPool(pool)
.withPriority(10)
.spawn() // Returns a future object
.waitForFinished();
Attachments
Issue Links
- relates to
-
QTBUG-83175 It should be possible to ignore the result of QTaskBuilder::spawn
- Closed