From 6fd1895b918c45d8404ff38319f508f0357cba27 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 16 Aug 2012 16:12:07 +0200 Subject: 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 Reviewed-by: Marc Mutz --- src/corelib/thread/qmutex.cpp | 17 +++++++++++++++-- src/corelib/thread/qmutex_p.h | 12 ------------ 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'src') 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 -- cgit v1.2.3