Android: Fix currentThreadId to work on Android emulator
Apparently the Linux asm assumptions are not correct for the
x86 Android emulator and this caused Android apps not to work
properly: signal connections being queued instead of being direct,
crashes in QPropertyAnimation, etc.
Using currentThreadIdImpl on the Android emulator works fine though.
Optimizing the code for the Android emulator case can be done in
another change.
Amends 5e9b2ade67
Fixes: QTBUG-85640
Change-Id: I3b3ba76ea143aed949a6e50678c850b6ba231476
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
75cd9c13c2
commit
f3eb9aa257
@ -182,12 +182,12 @@ inline Qt::HANDLE QThread::currentThreadId() noexcept
|
||||
Qt::HANDLE tid; // typedef to void*
|
||||
static_assert(sizeof(tid) == sizeof(void*));
|
||||
// See https://akkadia.org/drepper/tls.pdf for x86 ABI
|
||||
#if defined(Q_PROCESSOR_X86_32) && defined(Q_OS_LINUX) // x86 32-bit always uses GS
|
||||
#if defined(Q_PROCESSOR_X86_32) && defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) // x86 32-bit always uses GS
|
||||
__asm__("movl %%gs:0, %0" : "=r" (tid) : : );
|
||||
#elif defined(Q_PROCESSOR_X86_64) && defined(Q_OS_DARWIN64)
|
||||
// 64bit macOS uses GS, see https://github.com/apple/darwin-xnu/blob/master/libsyscall/os/tsd.h
|
||||
__asm__("movq %%gs:0, %0" : "=r" (tid) : : );
|
||||
#elif defined(Q_PROCESSOR_X86_64) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD))
|
||||
#elif defined(Q_PROCESSOR_X86_64) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)) && !defined(Q_OS_ANDROID)
|
||||
// x86_64 Linux, BSD uses FS
|
||||
__asm__("movq %%fs:0, %0" : "=r" (tid) : : );
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user