diff options
author | Liang Qi <liang.qi@qt.io> | 2019-08-27 09:45:52 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-08-27 09:45:52 +0200 |
commit | 0f1f7fb97fd0dd572ad61a0ebaef68c2bba72e57 (patch) | |
tree | e1f3f1b58aa69904e6bc629e88ed68fca858f83a /src/corelib/thread | |
parent | e8c70fb07f01b492b721451c00496f860eb40be0 (diff) | |
parent | 5bb178c479a247720fbc3fbb7f06a32b725193ac (diff) |
Merge remote-tracking branch 'origin/dev' into 5.14
Conflicts:
src/widgets/kernel/qwidget.cpp
src/widgets/kernel/qwidget_p.h
src/widgets/kernel/qwidgetrepaintmanager.cpp
src/widgets/kernel/qwidgetwindow.cpp
tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
Change-Id: Ifae457d0427be8e2465e474b055722e11b3b1e5c
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 38e9c1c3ec..cb3c0d6bb1 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -108,20 +108,8 @@ Q_STATIC_ASSERT(sizeof(pthread_t) <= sizeof(Qt::HANDLE)); enum { ThreadPriorityResetFlag = 0x80000000 }; -#if defined(Q_OS_LINUX) && defined(__GLIBC__) && (defined(Q_CC_GNU) || defined(Q_CC_INTEL)) && !defined(QT_LINUXBASE) -/* LSB doesn't have __thread, https://lsbbugs.linuxfoundation.org/show_bug.cgi?id=993 */ -#define HAVE_TLS -#endif -#if defined(Q_CC_XLC) || defined (Q_CC_SUN) -#define HAVE_TLS -#endif -#if defined(Q_OS_RTEMS) -#define HAVE_TLS -#endif -#ifdef HAVE_TLS -static __thread QThreadData *currentThreadData = 0; -#endif +static thread_local QThreadData *currentThreadData = 0; static pthread_once_t current_thread_data_once = PTHREAD_ONCE_INIT; static pthread_key_t current_thread_data_key; @@ -182,28 +170,19 @@ 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(¤t_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(¤t_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); } |