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>bb10
parent
bd5b4de839
commit
6fd1895b91
|
|
@ -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--;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue