Details
-
Suggestion
-
Resolution: Done
-
P3: Somewhat important
-
None
-
None
-
451fb66212b015b44a017e05a224af2df9a95755 (qt/qtbase/dev)
Description
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.