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

Derive QThreadPool thread names from the QThreadPool object name

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 6.2.0 Alpha
    • None
    • Core: Threads
    • None
    • 451fb66212b015b44a017e05a224af2df9a95755 (qt/qtbase/dev)

      Today QThreadPool names are always set like this:

      void QThreadPoolPrivate::startThread(QRunnable *runnable)
      {
          Q_ASSERT(runnable != nullptr);
          QScopedPointer <QThreadPoolThread> thread(new QThreadPoolThread(this));
          thread->setObjectName(QLatin1String("Thread (pooled)"));
          Q_ASSERT(!allThreads.contains(thread.data())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here)
          allThreads.insert(thread.data());
          ++activeThreads;
      
          thread->runnable = runnable;
          thread.take()->start();
      }

      It would be nice if the QThreadPool object name was used as a base, ie that the above was changed to use something like this to set the pool name (Not sure about the Q_Q thing):

      Q_Q(const QThreadPool);
      const auto pool_name = q->objectName();
      thread->setObjectName(pool_name.isEmpty() ? "Thread (pooled)" : pool_name);

      It is a small thing, but it would make "top" more useful when it is configured to show threads and it would be nice when reviewing coredumps.

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

            thiago Thiago Macieira
            ts Thomas Sondergaard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes