From 3717802653049b794d5fbb006b8a671bd02e5896 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Aug 2012 22:37:42 +0200 Subject: Small optimisation to recursive mutexes A recursive mutex operates on top of a non-recursive mutex. Therefore, we can bypass the test for recursive. The end result is simply that the compiler can inline the locking and unlocking a little better inside the lock() and unlock() functions Change-Id: Ic06d1344ccd411c22cbdef74536f3a4d368d75d7 Reviewed-by: Olivier Goffart --- src/corelib/thread/qmutex.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 1d35b76c92..1a064a1775 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -520,7 +520,7 @@ bool QRecursiveMutexPrivate::lock(int timeout) QT_MUTEX_LOCK_NOEXCEPT } bool success = true; if (timeout == -1) { - mutex.lock(); + mutex.QBasicMutex::lock(); } else { success = mutex.tryLock(timeout); } @@ -539,7 +539,7 @@ void QRecursiveMutexPrivate::unlock() Q_DECL_NOTHROW count--; } else { owner = 0; - mutex.unlock(); + mutex.QBasicMutex::unlock(); } } -- cgit v1.2.3