summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorIevgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>2021-09-27 13:54:41 +0200
committerIevgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>2021-09-28 13:42:16 +0200
commit05870db7d0606e0a64115a523bf1366137f34700 (patch)
treedf78c21ecf7fc5314e71fe14a83d4c84c30ecc12 /src/corelib/thread
parent416fbfa5a017406535a62a503411039d7a17c844 (diff)
QThread: Remove superfluous initialization of threadId on Unix
The thread ID is already initialized inside QThread::start() while the thread lock is taken. This is completed before the attempted initialization in QThreadPrivate::start() because it tries to take the same lock. Task-number: QTBUG-96846 Pick-to: 5.15 6.2 Change-Id: Ic9588f3e2e2f3c2180afbed8ec01155b33043eb3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qthread_unix.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index ad13f10890..640906f4c1 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -304,7 +304,9 @@ void *QThreadPrivate::start(void *arg)
thr->d_func()->setPriority(QThread::Priority(qToUnderlying(thr->d_func()->priority) & ~ThreadPriorityResetFlag));
}
- data->threadId.storeRelaxed(to_HANDLE(pthread_self()));
+ // threadId is set in QThread::start()
+ Q_ASSERT(pthread_equal(from_HANDLE<pthread_t>(data->threadId.loadRelaxed()),
+ pthread_self()));
set_thread_data(data);
data->ref();