diff options
author | Robin Burchell <robin.burchell@collabora.co.uk> | 2012-05-02 11:23:40 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-02 17:55:22 +0200 |
commit | 0c1ae68c0aea64aa984d98619f581ab6cf8593f3 (patch) | |
tree | e9515d98b72e260b49914b11d5317c258392c602 /src/corelib/thread/qmutex_linux.cpp | |
parent | a818a1eb2f3d2c5ac61da7e1a8cf1b341e63aed1 (diff) |
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 <thiago.macieira@intel.com>
Change-Id: I0ba449b740acf2c78825f8093d1515a74f0bc9cd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qmutex_linux.cpp')
-rw-r--r-- | src/corelib/thread/qmutex_linux.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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 <sys/syscall.h> #include <unistd.h> #include <errno.h> +#include <asm/unistd.h> #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() |