diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2016-04-25 16:42:11 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2016-05-09 07:48:30 +0000 |
commit | 0b1b06ffc0a334263c01e32e5bfb50b4d96ba70d (patch) | |
tree | 66f6a13e4551e4f4a11117d4b78d239109d9230c /src/corelib/thread/qmutex.h | |
parent | 75d65600f9fd41cb88068c664e3e94bb67eebc93 (diff) |
Add a QMutex::isRecursive() const noexcept
This is source- and binary-compatible, including the marking of the
existing function as noexcept.
[ChangeLog][QtCore][QMutex] Made the isRecursive() method be a const
function so that it can be called in const QMutex objects too.
Change-Id: Ifea6e497f11a461db432ffff1448bead97c08f92
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/thread/qmutex.h')
-rw-r--r-- | src/corelib/thread/qmutex.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h index 57f89aa439..a06bcd99ac 100644 --- a/src/corelib/thread/qmutex.h +++ b/src/corelib/thread/qmutex.h @@ -75,7 +75,8 @@ public: return fastTryLock(); } - bool isRecursive(); //### Qt6: mark const + bool isRecursive() Q_DECL_NOTHROW; //### Qt6: remove me + bool isRecursive() const Q_DECL_NOTHROW; private: inline bool fastTryLock() Q_DECL_NOTHROW { @@ -104,7 +105,8 @@ private: friend class QMutexData; }; -class Q_CORE_EXPORT QMutex : public QBasicMutex { +class Q_CORE_EXPORT QMutex : public QBasicMutex +{ public: enum RecursionMode { NonRecursive, Recursive }; explicit QMutex(RecursionMode mode = NonRecursive); @@ -114,7 +116,8 @@ public: bool tryLock(int timeout = 0) QT_MUTEX_LOCK_NOEXCEPT; void unlock() Q_DECL_NOTHROW; - using QBasicMutex::isRecursive; + bool isRecursive() const Q_DECL_NOTHROW + { return QBasicMutex::isRecursive(); } private: Q_DISABLE_COPY(QMutex) @@ -187,7 +190,7 @@ public: inline void lock() Q_DECL_NOTHROW {} inline bool tryLock(int timeout = 0) Q_DECL_NOTHROW { Q_UNUSED(timeout); return true; } inline void unlock() Q_DECL_NOTHROW {} - inline bool isRecursive() Q_DECL_NOTHROW { return true; } + inline bool isRecursive() const Q_DECL_NOTHROW { return true; } private: Q_DISABLE_COPY(QMutex) |