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:
parent
4a0565b443
commit
46bfd84fdc
@ -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()
|
||||
*/
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user