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

QThreadPool::waitForDone() should have an option to not remove threads

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • Not Evaluated
    • 5.2.0
    • 4.8.6, 5.3.1
    • Core: Threads
    • None
    • 0d8ba7e34974fe9c1a60977a10d34413650b33b0

    Description

      waitForDone() is a very handy method, but for some reason it releases all the threads of the pool. Here is a simple scenario that requires a slightly different behavior:

      1. a software renders a complex picture each frame (think of raytracing software)
      2. it splits each frame to a set of chunks and renders them using QThreadPool
      3. the software needs to wait for the rendering to finish before displaying a frame
      4. the software needs to do the same for the next frame

      QThreadPool fits perfect in this scenario, except for the 3rd clause, as there is no method to wait for the frame to be rendered without deleting all the threads that need to be re-created at the next frame, which takes time.

      The code modification required are minimal and should not affect the old code if you keep the default behavior, but allow the caller to override it using additional parameter or a new method.

      Attachments

        Activity

          People

            thiago Thiago Macieira
            ov Vitaly Ovchinnikov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: