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>
This commit is contained in:
Harald Fernengel 2012-02-20 09:37:07 +01:00 committed by Qt by Nokia
parent 4a0565b443
commit 46bfd84fdc
3 changed files with 19 additions and 9 deletions

View File

@ -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()
*/

View File

@ -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
{

View File

@ -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
}
}