15#include "kleo_export.h"
45inline constexpr TryToLockType tryToLock{};
48inline constexpr AdoptLockType adoptLock{};
67 template<
typename Clock,
typename Duration>
68 UniqueLock(
QMutex &mutex,
const std::chrono::time_point<Clock, Duration> &timePoint)
69 : mMutex{std::addressof(mutex)}
70 , mOwnsMutex{mMutex->try_lock_until(timePoint)}
74 template<
typename Rep,
typename Period>
75 UniqueLock(
QMutex &mutex,
const std::chrono::duration<Rep, Period> &duration)
76 : mMutex{std::addressof(mutex)}
77 , mOwnsMutex{mMutex->try_lock_for(duration)}
93 template<
typename Clock,
typename Duration>
94 bool try_lock_until(
const std::chrono::time_point<Clock, Duration> &timePoint)
97 Q_ASSERT(!mOwnsMutex);
98 if (mMutex && !mOwnsMutex) {
99 mOwnsMutex = mMutex->try_lock_until(timePoint);
104 template<
typename Rep,
typename Period>
105 bool try_lock_for(
const std::chrono::duration<Rep, Period> &duration)
108 Q_ASSERT(!mOwnsMutex);
109 if (mMutex && !mOwnsMutex) {
110 mOwnsMutex = mMutex->try_lock_for(duration);
119 QMutex *release()
noexcept;
121 bool owns_lock()
const noexcept;
123 explicit operator bool()
const noexcept;
125 QMutex *mutex()
const noexcept;
A movable scoped lock type for QMutex.
Assume the calling thread has already obtained mutex ownership and manage it.
Do not acquire ownership of the mutex.
Try to acquire ownership of the mutex without blocking.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:01 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.