From 34a3885feb301aa0f9413f8246a0838f5ef295f2 Mon Sep 17 00:00:00 2001 From: Ievgenii Meshcheriakov Date: Mon, 27 Sep 2021 13:54:41 +0200 Subject: QThread: Remove superfluous initialization of threadId on Unix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Change-Id: Ic9588f3e2e2f3c2180afbed8ec01155b33043eb3 Reviewed-by: Edward Welbourne Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Thiago Macieira (cherry picked from commit 05870db7d0606e0a64115a523bf1366137f34700) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/thread/qthread_unix.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 205ae50035..66a48932ef 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -300,7 +300,9 @@ void *QThreadPrivate::start(void *arg) thr->d_func()->setPriority(QThread::Priority(thr->d_func()->priority & ~ThreadPriorityResetFlag)); } - data->threadId.storeRelaxed(to_HANDLE(pthread_self())); + // threadId is set in QThread::start() + Q_ASSERT(pthread_equal(from_HANDLE(data->threadId.loadRelaxed()), + pthread_self())); set_thread_data(data); data->ref(); -- cgit v1.2.3