From 0c1ae68c0aea64aa984d98619f581ab6cf8593f3 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 2 May 2012 11:23:40 +0200 Subject: Work around Android not having SYS_futex. Even though we really shouldn't, we can get away with using __NR_futex instead. Done-with: Thiago Macieira Change-Id: I0ba449b740acf2c78825f8093d1515a74f0bc9cd Reviewed-by: Thiago Macieira --- src/corelib/thread/qmutex_linux.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/corelib/thread/qmutex_linux.cpp') diff --git a/src/corelib/thread/qmutex_linux.cpp b/src/corelib/thread/qmutex_linux.cpp index 76e644ae51..a10bd35eff 100644 --- a/src/corelib/thread/qmutex_linux.cpp +++ b/src/corelib/thread/qmutex_linux.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #ifndef QT_LINUX_FUTEX # error "Qt build is broken: qmutex_linux.cpp is being built but futex support is not wanted" @@ -71,7 +72,7 @@ static inline int futexFlags() // try an operation that has no side-effects: wake up 42 threads // futex will return -1 (errno==ENOSYS) if the flag isn't supported // there should be no other error conditions - value = syscall(SYS_futex, &futexFlagSupport, + value = syscall(__NR_futex, &futexFlagSupport, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 42, 0, 0, 0); if (value != -1) { @@ -95,7 +96,9 @@ static inline int _q_futex(void *addr, int op, int val, const struct timespec *t int *addr2 = 0; int val2 = 0; - return syscall(SYS_futex, int_addr, op | futexFlags(), val, timeout, addr2, val2); + // we use __NR_futex because some libcs (like Android's bionic) don't + // provide SYS_futex etc. + return syscall(__NR_futex, int_addr, op | futexFlags(), val, timeout, addr2, val2); } static inline QMutexData *dummyFutexValue() -- cgit v1.2.3