summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-04-08 11:04:53 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2011-04-08 11:13:28 +0200
commit7f18116cbf6bcae95473ff2d41929ddef66f74c9 (patch)
treebab2fd76d0be93437331b68d38abf6ce0ee20918 /src/corelib/thread
parentece08933ededbc5c484087b427a1b97e63fde69c (diff)
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/thread')
-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 a8c592441f..89546b689b 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);
}