1 #ifndef THREADING_UTILS_TRYLOCKER_H 2 #define THREADING_UTILS_TRYLOCKER_H 6 QT_FORWARD_DECLARE_CLASS(QMutex)
13 template<
typename Mutex = QMutex>
21 m_mutex(mutex.tryLock() ? &mutex : nullptr)
40 return m_mutex !=
nullptr;
48 return m_mutex !=
nullptr;
57 #endif // THREADING_UTILS_TRYLOCKER_H bool isLocked() const
Returns whether the mutex could be locked.
Like QMutexLocker, but it just tries to lock the mutex.
TryLocker(Mutex &mutex)
Tries to lock the specified mutex.
~TryLocker()
Unlocks the mutex specified when constructing.