summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-04-28 17:47:57 -0700
committerThiago Macieira <thiago.macieira@intel.com>2016-04-30 03:00:33 +0000
commit112e53fdc4e46a5e94cb2d575d132e2015694407 (patch)
tree999de17175e00356d1a684b37a0298789a7eea62 /src/corelib/thread/qthread_p.h
parent002112e80516a29efbb6cef721d74c5fc39fc19d (diff)
Don't store the pthread_t thread ID twice in QThread
It was being stored once in QThreadPrivate and once in QThreadData, with the latter being hidden as a Qt::HANDLE. Besides saving a little bit of memory, this also solves a small data race condition that arises from trying to connect a signal to an object moved to that thread and then emit that signal shortly after the thread starts. Before this patch, QThreadData::threadId was initialized only by QThreadPrivate::start(), which meant that we were racing that initialization with this check in QMetaObject::activate: const bool receiverInSameThread = currentThreadId == receiver->d_func()->threadData->threadId; Task-number: QTBUG-52337 Change-Id: Ifea6e497f11a461db432ffff1449ae01f1099aae Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'src/corelib/thread/qthread_p.h')
-rw-r--r--src/corelib/thread/qthread_p.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index a0d354acdc..a56b879462 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -169,7 +169,6 @@ public:
static QThread *threadForId(int id);
#ifdef Q_OS_UNIX
- pthread_t thread_id;
QWaitCondition thread_done;
static void *start(void *arg);