diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-08-16 16:12:07 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-14 03:45:50 +0200 |
commit | 6fd1895b918c45d8404ff38319f508f0357cba27 (patch) | |
tree | 081a24c19215c0e394bbaab9c51fcc505ecd06b4 /src | |
parent | bd5b4de839938bd3be253b1708439fed6f275b7c (diff) |
Move QRecursiveMutexPrivate to qmutex.cpp and mark inline
Disassembly of the optimised code shows that the compiler was already
inlining the bodies of one or both functions (since they're in the same
.cpp, it's allowed to do that).
However, since there was no "inline" marker, the compiler was also
emitting an out-of-line copy, which wasn't used by anyone, as the class
is not exported.
So add the marker. To make sure that they don't get used by accident
elsewhere, the class is moved to the .cpp file too.
Change-Id: Iead578ec9c7d8dd6b4e6bb582ce5b829cdec5992
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/thread/qmutex.cpp | 17 | ||||
-rw-r--r-- | src/corelib/thread/qmutex_p.h | 12 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 305074f096..2bf3176787 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -69,6 +69,19 @@ static inline bool isRecursive(QMutexData *d) #endif } +class QRecursiveMutexPrivate : public QMutexData +{ +public: + QRecursiveMutexPrivate() + : QMutexData(QMutex::Recursive), owner(0), count(0) {} + Qt::HANDLE owner; + uint count; + QMutex mutex; + + bool lock(int timeout) QT_MUTEX_LOCK_NOEXCEPT; + void unlock() Q_DECL_NOTHROW; +}; + /* \class QBasicMutex \inmodule QtCore @@ -544,7 +557,7 @@ void QMutexPrivate::derefWaiters(int value) Q_DECL_NOTHROW /*! \internal */ -bool QRecursiveMutexPrivate::lock(int timeout) QT_MUTEX_LOCK_NOEXCEPT +inline bool QRecursiveMutexPrivate::lock(int timeout) QT_MUTEX_LOCK_NOEXCEPT { Qt::HANDLE self = QThread::currentThreadId(); if (owner == self) { @@ -567,7 +580,7 @@ bool QRecursiveMutexPrivate::lock(int timeout) QT_MUTEX_LOCK_NOEXCEPT /*! \internal */ -void QRecursiveMutexPrivate::unlock() Q_DECL_NOTHROW +inline void QRecursiveMutexPrivate::unlock() Q_DECL_NOTHROW { if (count > 0) { count--; diff --git a/src/corelib/thread/qmutex_p.h b/src/corelib/thread/qmutex_p.h index f51dd0e9e3..6d84732751 100644 --- a/src/corelib/thread/qmutex_p.h +++ b/src/corelib/thread/qmutex_p.h @@ -131,18 +131,6 @@ public: }; #endif //QT_LINUX_FUTEX -class QRecursiveMutexPrivate : public QMutexData -{ -public: - QRecursiveMutexPrivate() - : QMutexData(QMutex::Recursive), owner(0), count(0) {} - Qt::HANDLE owner; - uint count; - QMutex mutex; - - bool lock(int timeout) QT_MUTEX_LOCK_NOEXCEPT; - void unlock() Q_DECL_NOTHROW; -}; QT_END_NAMESPACE |