diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-05-23 10:26:07 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-29 07:35:31 +0200 |
commit | 88da8b4878a97faf2304a517e6173535bd6fb787 (patch) | |
tree | 2c60b1faf5a57c88a89bdc097fd57b1ff9e5a5cf /src/corelib/thread/qmutex.cpp | |
parent | 61904b8cfc68f3668ec9beed6e0746cf16d1a5f6 (diff) |
QMutex: de-inline lock(), unlock(), and tryLock()
See the discussion of this topic on the mailing list:
http://lists.qt-project.org/pipermail/development/2012-May/003943.html
The consensus is to not have these methods have inline code to actually
acquire the lock (i.e. no atomic test-and-set or similar). QBasicMutex
is unchanged, and continues to have inlined lock(), tryLock(), and
unlock(). QMutexLocker has been changed to always call QMutex::lock()
(even though the constructor takes a QBasicMutex parameter).
Change-Id: Ic7d2d9d581e6b254c84fdfdd8ce6c425535a8078
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qmutex.cpp')
-rw-r--r-- | src/corelib/thread/qmutex.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 145916d750..d310f56798 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -177,6 +177,10 @@ QMutex::~QMutex() \sa unlock() */ +void QMutex::lock() +{ + QBasicMutex::lock(); +} /*! \fn bool QMutex::tryLock(int timeout) @@ -201,7 +205,10 @@ QMutex::~QMutex() \sa lock(), unlock() */ - +bool QMutex::tryLock(int timeout) +{ + return QBasicMutex::tryLock(timeout); +} /*! \fn void QMutex::unlock() Unlocks the mutex. Attempting to unlock a mutex in a different @@ -210,6 +217,10 @@ QMutex::~QMutex() \sa lock() */ +void QMutex::unlock() +{ + QBasicMutex::unlock(); +} /*! \fn void QMutex::isRecursive() |