Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-38239

Make nested QtConcurrent::run() calls possible without the risk of a deadlock

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • Not Evaluated
    • None
    • 5.3.0 Beta1
    • Core: QtConcurrent
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sonakur Sona Kurazyan
            andysh Andy Shaw
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes