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

QtConcurrent specifying max thread count

    XMLWordPrintable

Details

    Description

      There should be a way to force QtConcurrent operations to serialize onto the main thread? For example, suppose I have a multi-threaded application and I'd like to provide a debug mode that serializes all threaded operations to ensure that threading is not a factor. I'd like to call an option like:

      QtConcurrent::setSerializeOperations(true);

      With this global parameter set, Any calls to QtConcurrent::run/map/mappedReduce/etc would be executed serially, in place,
      on the calling thread.

      Alternatively, this could be done by specifying:

      QThreadPool::globalInstance.setMaxThreadCount(0);

      This implementation would likely be even easier - as the implementation
      could be:

      void QThreadPool::start(QRunnable *runnable, int priority)
      {
      if(maxThreadCount == 0) // Serial execution

      { runnable->run(); }

      else

      { // .... existing code ..... }

      return;
      }

      Attachments

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

        Activity

          People

            sonakur Sona Kurazyan
            janichol Andy Nichols
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes