diff options
Diffstat (limited to 'src/corelib/thread/qmutex.h')
| -rw-r--r-- | src/corelib/thread/qmutex.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h index f57a95de223..e10a3f8f3db 100644 --- a/src/corelib/thread/qmutex.h +++ b/src/corelib/thread/qmutex.h @@ -247,6 +247,13 @@ public: } } + inline QMutexLocker(QMutexLocker &&other) noexcept + : m_mutex(std::exchange(other.m_mutex, nullptr)), + m_isLocked(std::exchange(other.m_isLocked, false)) + {} + + QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QMutexLocker) + inline ~QMutexLocker() { unlock(); @@ -275,6 +282,12 @@ public: } } + inline void swap(QMutexLocker &other) noexcept + { + qt_ptr_swap(m_mutex, other.m_mutex); + std::swap(m_isLocked, other.m_isLocked); + } + Mutex *mutex() const { return m_mutex; |
