summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorHarald Fernengel <harald.fernengel@nokia.com>2012-02-20 09:37:07 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-20 11:45:01 +0100
commit46bfd84fdc24fa3e3e721a5dda6cfbebe75be073 (patch)
tree51366da8f6f7ae38d3e24ce70c7703cb56f886e9 /src/corelib/thread
parent4a0565b4439b9bb71d0e7a77b15b85611a697f57 (diff)
Use standard unix mutexes on LSB
LSB doesn't allow syscalls, so fall back to the normal _unix implementation Change-Id: I8aba6147da8b46e3f85b0454cf9aca219811c9fe Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qmutex.cpp6
-rw-r--r--src/corelib/thread/qmutex_p.h12
-rw-r--r--src/corelib/thread/thread.pri10
3 files changed, 19 insertions, 9 deletions
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp
index 4a64feff0e..e13c78636c 100644
--- a/src/corelib/thread/qmutex.cpp
+++ b/src/corelib/thread/qmutex.cpp
@@ -49,7 +49,7 @@
#include "qthread.h"
#include "qmutex_p.h"
-#ifndef Q_OS_LINUX
+#ifndef Q_MUTEX_LINUX
#include "private/qfreelist_p.h"
#endif
@@ -154,7 +154,7 @@ QMutex::~QMutex()
if (quintptr(d) > 0x3 && d->recursive) {
delete static_cast<QRecursiveMutexPrivate *>(d);
} else if (d) {
-#ifndef Q_OS_LINUX
+#ifndef Q_MUTEX_LINUX
if (d != dummyLocked() && static_cast<QMutexPrivate *>(d)->possiblyUnlocked.load()
&& tryLock()) {
unlock();
@@ -340,7 +340,7 @@ bool QBasicMutex::isRecursive() {
\sa unlock()
*/
-#ifndef Q_OS_LINUX //linux implementation is in qmutex_linux.cpp
+#ifndef Q_MUTEX_LINUX //linux implementation is in qmutex_linux.cpp
/*!
\internal helper for lock()
*/
diff --git a/src/corelib/thread/qmutex_p.h b/src/corelib/thread/qmutex_p.h
index 3cf0938e94..8a9d0bf39b 100644
--- a/src/corelib/thread/qmutex_p.h
+++ b/src/corelib/thread/qmutex_p.h
@@ -63,6 +63,11 @@
# include <mach/semaphore.h>
#endif
+#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
+// use Linux mutexes everywhere except for LSB builds
+# define Q_MUTEX_LINUX
+#endif
+
QT_BEGIN_NAMESPACE
class QMutexData
@@ -73,8 +78,9 @@ public:
: recursive(mode == QMutex::Recursive) {}
};
-#if !defined(Q_OS_LINUX)
-class QMutexPrivate : public QMutexData {
+#if !defined(Q_MUTEX_LINUX)
+class QMutexPrivate : public QMutexData
+{
public:
~QMutexPrivate();
QMutexPrivate();
@@ -122,7 +128,7 @@ public:
Qt::HANDLE event;
#endif
};
-#endif //Q_OS_LINUX
+#endif //Q_MUTEX_LINUX
class QRecursiveMutexPrivate : public QMutexData
{
diff --git a/src/corelib/thread/thread.pri b/src/corelib/thread/thread.pri
index 1eefa60d50..7f383d6a4c 100644
--- a/src/corelib/thread/thread.pri
+++ b/src/corelib/thread/thread.pri
@@ -44,8 +44,12 @@ integrity:SOURCES += thread/qmutex_unix.cpp \
thread/qwaitcondition_unix.cpp
unix: {
- macx-* { SOURCES += thread/qmutex_mac.cpp }
- else:linux-* { SOURCES += thread/qmutex_linux.cpp }
- else { SOURCES += thread/qmutex_unix.cpp }
+ macx-* {
+ SOURCES += thread/qmutex_mac.cpp
+ } else:linux-*:!linux-lsb-* {
+ SOURCES += thread/qmutex_linux.cpp
+ } else {
+ SOURCES += thread/qmutex_unix.cpp
+ }
}