QCoreApplication: give theMainThread an objectName to aid debugging
It can be hard to distinguish QThreads without object names when debugging. Change-Id: I42643495344063b7c05c7639dcc15c6600e617dc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit ba13bbd2d32652c8ffeef691c9a2ed3a7a65a82f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
4757bab0a9
commit
4378364a50
@ -1093,7 +1093,9 @@ QThreadData *QThreadData::current(bool createIfNecessary)
|
|||||||
data->deref();
|
data->deref();
|
||||||
data->isAdopted = true;
|
data->isAdopted = true;
|
||||||
if (!QCoreApplicationPrivate::theMainThreadId.loadAcquire()) {
|
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());
|
QCoreApplicationPrivate::theMainThreadId.storeRelaxed(data->threadId.loadRelaxed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,9 @@ QThreadData *QThreadData::current(bool createIfNecessary)
|
|||||||
data->isAdopted = true;
|
data->isAdopted = true;
|
||||||
data->threadId.storeRelaxed(to_HANDLE(pthread_self()));
|
data->threadId.storeRelaxed(to_HANDLE(pthread_self()));
|
||||||
if (!QCoreApplicationPrivate::theMainThreadId.loadAcquire()) {
|
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());
|
QCoreApplicationPrivate::theMainThreadId.storeRelaxed(data->threadId.loadRelaxed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,9 @@ QThreadData *QThreadData::current(bool createIfNecessary)
|
|||||||
threadData->threadId.storeRelaxed(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())));
|
threadData->threadId.storeRelaxed(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())));
|
||||||
|
|
||||||
if (!QCoreApplicationPrivate::theMainThreadId) {
|
if (!QCoreApplicationPrivate::theMainThreadId) {
|
||||||
QCoreApplicationPrivate::theMainThread.storeRelease(threadData->thread.loadRelaxed());
|
auto *mainThread = threadData->thread.loadRelaxed();
|
||||||
|
mainThread->setObjectName("Qt mainThread");
|
||||||
|
QCoreApplicationPrivate::theMainThread.storeRelease(mainThread);
|
||||||
QCoreApplicationPrivate::theMainThreadId.storeRelaxed(threadData->threadId.loadRelaxed());
|
QCoreApplicationPrivate::theMainThreadId.storeRelaxed(threadData->threadId.loadRelaxed());
|
||||||
} else {
|
} else {
|
||||||
HANDLE realHandle = INVALID_HANDLE_VALUE;
|
HANDLE realHandle = INVALID_HANDLE_VALUE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user