summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-04-08 09:04:53 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-04-08 09:13:28 (GMT)
commit7f18116cbf6bcae95473ff2d41929ddef66f74c9 (patch)
treebab2fd76d0be93437331b68d38abf6ce0ee20918 /src/corelib
parentece08933ededbc5c484087b427a1b97e63fde69c (diff)
downloadQt-7f18116cbf6bcae95473ff2d41929ddef66f74c9.zip
Qt-7f18116cbf6bcae95473ff2d41929ddef66f74c9.tar.gz
Qt-7f18116cbf6bcae95473ff2d41929ddef66f74c9.tar.bz2
Re-apply part of ba8e5eedf5f40091eb67dd391a7dcaf9299db2f5
It was somehow lost in the merge of the native symbian threads (wrong merge was cf94df01d2d2364653f2ab602688394450e92d31)
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/thread/qthread_unix.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index a8c5924..89546b6 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -170,18 +170,28 @@ Q_DESTRUCTOR_FUNCTION(destroy_current_thread_data_key)
// Utility functions for getting, setting and clearing thread specific data.
static QThreadData *get_thread_data()
{
+#ifdef HAVE_TLS
+ return currentThreadData;
+#else
pthread_once(&current_thread_data_once, create_current_thread_data_key);
return reinterpret_cast<QThreadData *>(pthread_getspecific(current_thread_data_key));
+#endif
}
static void set_thread_data(QThreadData *data)
{
+#ifdef HAVE_TLS
+ currentThreadData = data;
+#endif
pthread_once(&current_thread_data_once, create_current_thread_data_key);
pthread_setspecific(current_thread_data_key, data);
}
static void clear_thread_data()
{
+#ifdef HAVE_TLS
+ currentThreadData = 0;
+#endif
pthread_setspecific(current_thread_data_key, 0);
}