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

QFutureSynchronizer: Make it a non-template class (7.0)

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 7.0 (Next Major Release)
    • Core: QtConcurrent
    • None
    • All

    Description

      1. Make QFutureSynchronizer a non-template class.
      2. Possibly model in on Creator's Utils::FutureSynchronizer (futuresynchronizer.h, futuresynchronizer.cpp).
      3. Consider changing the default for cancelOnWait from false into true. The false value makes only sense for a blocking calls in a non-main thread, when in a non-main thread many sub-threads were started and we want to blocking synchronize them. The synchronizer inside QtCreator plays often a different role. When we want to quickly stop the running async call, instead of canceling the future and blocking wait for it to finish inside the main thread, we are putting the running future into the synchronizer, so that it still spins for a while, without blocking a main thread. Sometimes, we are already putting the future into the synchronizer just after it has are started, as not to forget to synchronize it when caller's future handle gets out of scope, e.g. when caller's object is deleted. The call to addFuture() may automatically (optionally) invoke the cancellation for the passed future. Later, on shutdown, when plugin's future synchronizer is destroyed, it blocking waits for all still spinning tasks. It makes sense to cancel all the futures in this case.
      4. For the reasons described in 3., it makes sense to have one common synchronizer able to gather futures of different types (i.e. from all different calls from e.g. one plugin).
      5. Remove clearFutures() method. Is there any sensible use case for it?
      6. Remove setFuture() method. Is there any sensible use case for it?

      Rationale:
      There is really no need for a class template, as it's only role is to cancel / waitForFinished for the passes futures.

      Please also take the differences in API names into account when comparing to Utils::FutureSynchronizer. We may start introducing new names already now (if decided so), so that we will have enough time to deprecate the old names for 7.0.

      Attachments

        Issue Links

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

          Activity

            People

              cnn Qt Core & Network
              jkobus Jarek Kobus
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes