diff options
author | The Qt Project <gerrit-noreply@qt-project.org> | 2019-10-14 08:49:14 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2019-10-14 08:49:14 +0000 |
commit | eba59bfd14d0ea29f36e80be81137d26cc67e23a (patch) | |
tree | 69ff8601b3d4a62bea38e1a32245f45cb744aaac /src/corelib/thread/qthread_unix.cpp | |
parent | f03ac58b1ecc24f01cb83b275a9b6088f9483545 (diff) | |
parent | f4b4c4f79b629498f3cddbbc10df8c1b4d6020d9 (diff) |
Merge "Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake" into wip/cmake
Diffstat (limited to 'src/corelib/thread/qthread_unix.cpp')
-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); } |