diff options
| author | Mitch Curtis <mitch.curtis@qt.io> | 2024-07-02 15:14:53 +0800 |
|---|---|---|
| committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2024-07-04 04:47:17 +0000 |
| commit | ba13bbd2d32652c8ffeef691c9a2ed3a7a65a82f (patch) | |
| tree | 84904b9e6884153979dc0f5fcdcf105585f4c10c /src/corelib/thread/qthread.cpp | |
| parent | e154da485e83d2867da391088ea4acb31eef6293 (diff) | |
QCoreApplication: give theMainThread an objectName to aid debugging
It can be hard to distinguish QThreads without object names when
debugging.
Pick-to: 6.8
Change-Id: I42643495344063b7c05c7639dcc15c6600e617dc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/thread/qthread.cpp')
| -rw-r--r-- | src/corelib/thread/qthread.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 738c3846c53..ee947c0c5f8 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -1093,7 +1093,9 @@ QThreadData *QThreadData::current(bool createIfNecessary) data->deref(); data->isAdopted = true; if (!QCoreApplicationPrivate::theMainThreadId.loadAcquire()) { - QCoreApplicationPrivate::theMainThread.storeRelease(data->thread.loadRelaxed()); + auto *mainThread = data->thread.loadRelaxed(); + mainThread->setObjectName("Qt mainThread"); + QCoreApplicationPrivate::theMainThread.storeRelease(mainThread); QCoreApplicationPrivate::theMainThreadId.storeRelaxed(data->threadId.loadRelaxed()); } } |
