Qt Utilities 6.14.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QtUtilities::TryLocker< Mutex > Class Template Reference

Like QMutexLocker, but it just tries to lock the mutex. More...

#include <trylocker.h>

Public Member Functions

 TryLocker (Mutex &mutex)
 Tries to lock the specified mutex.
 
 ~TryLocker ()
 Unlocks the mutex specified when constructing.
 
bool isLocked () const
 Returns whether the mutex could be locked.
 
 operator bool () const
 Returns whether the mutex could be locked.
 

Detailed Description

template<typename Mutex = QMutex>
class QtUtilities::TryLocker< Mutex >

Like QMutexLocker, but it just tries to lock the mutex.

Definition at line 13 of file trylocker.h.

Constructor & Destructor Documentation

◆ TryLocker()

template<typename Mutex = QMutex>
QtUtilities::TryLocker< Mutex >::TryLocker ( Mutex & mutex)
inline

Tries to lock the specified mutex.

Definition at line 18 of file trylocker.h.

◆ ~TryLocker()

template<typename Mutex = QMutex>
QtUtilities::TryLocker< Mutex >::~TryLocker ( )
inline

Unlocks the mutex specified when constructing.

Remarks
Does nothing if the mutex couldn't be locked in the first place.

Definition at line 27 of file trylocker.h.

Member Function Documentation

◆ isLocked()

template<typename Mutex = QMutex>
bool QtUtilities::TryLocker< Mutex >::isLocked ( ) const
inline

Returns whether the mutex could be locked.

Definition at line 37 of file trylocker.h.

◆ operator bool()

template<typename Mutex = QMutex>
QtUtilities::TryLocker< Mutex >::operator bool ( ) const
inline

Returns whether the mutex could be locked.

Definition at line 45 of file trylocker.h.


The documentation for this class was generated from the following file: