summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread_win.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-03-28 16:54:06 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-03-31 14:32:42 (GMT)
commitdf9491b302f6404ad2ccc6dc2eb3377176d994c6 (patch)
treeea041707bfae4eb5586b3b67c7f24b9a262e09c0 /src/corelib/thread/qthread_win.cpp
parent3ae213cdeffae107ffa5a4b552c6351123dcc5cb (diff)
downloadQt-df9491b302f6404ad2ccc6dc2eb3377176d994c6.zip
Qt-df9491b302f6404ad2ccc6dc2eb3377176d994c6.tar.gz
Qt-df9491b302f6404ad2ccc6dc2eb3377176d994c6.tar.bz2
Optimize QMetaObject::activate (remove call to QThreadData::current)
QThreadData::current is too slow, it needs to access the TLS The currentThreadId is much faster. Reviewed-by: Brad
Diffstat (limited to 'src/corelib/thread/qthread_win.cpp')
-rw-r--r--src/corelib/thread/qthread_win.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index b9c55b0..bab6cf8 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -125,6 +125,7 @@ QThreadData *QThreadData::current()
threadData->deref();
}
threadData->isAdopted = true;
+ threadData->threadId = (Qt::HANDLE)GetCurrentThreadId();
if (!QCoreApplicationPrivate::theMainThread) {
QCoreApplicationPrivate::theMainThread = threadData->thread;
@@ -306,6 +307,7 @@ unsigned int __stdcall QThreadPrivate::start(void *arg)
qt_create_tls();
TlsSetValue(qt_current_thread_data_tls_index, data);
+ data->threadId = (Qt::HANDLE)GetCurrentThreadId();
QThread::setTerminationEnabled(false);