Details
-
Suggestion
-
Resolution: Done
-
Not Evaluated
-
None
-
5.3.0 Beta1
-
None
Description
Make nested QtConcurrent::run() calls possible without the risk of a deadlock.
Suggestions on how to implement this from the original reporter:
Solution A: Make the QThreadPool selectable.
If the thread pool is selectable, the main tasks can use a different thread pool as the subtasks. This avoids deadlocks and solves many other problems in complex applications.
Solution B: Detect nested calls and make them sequential.
A nested call of QtConcurrent::run just stops the current task and uses this thread to execute the nested task. In other words: If there aren't enough threads left to run all tasks in parallel, it automatically runs them nested sequentially to avoid deadlocks.