Manages locking and unlocking of a mutes. More...
#include <ScopedMutexLock.h>
Public Member Functions | |
bool | isLocked () const |
operator bool () const | |
ScopedMutexLock (Mutex &mutex, bool force=true) | |
~ScopedMutexLock () | |
Private Attributes | |
bool | m_is_locked |
Mutex & | m_mutex |
Manages locking and unlocking of a mutes.
Locks or tries to lock a mutex in the constructor and unlocks it in the destructor.
Definition at line 50 of file ScopedMutexLock.h.
icl_core::thread::ScopedMutexLock::ScopedMutexLock | ( | Mutex & | mutex, |
bool | force = true |
||
) | [explicit] |
Locks the mutex.
mutex | The mutex to use. |
force | Ensure at all cost that IsLocked() is true . |
Definition at line 30 of file ScopedMutexLock.cpp.
Unlocks the mutex.
Definition at line 40 of file ScopedMutexLock.cpp.
bool icl_core::thread::ScopedMutexLock::isLocked | ( | ) | const [inline] |
Check if the mutex has been successfully locked.
Definition at line 64 of file ScopedMutexLock.h.
icl_core::thread::ScopedMutexLock::operator bool | ( | ) | const [inline] |
Implicit conversion to bool.
Definition at line 68 of file ScopedMutexLock.h.
bool icl_core::thread::ScopedMutexLock::m_is_locked [private] |
Definition at line 83 of file ScopedMutexLock.h.
Mutex& icl_core::thread::ScopedMutexLock::m_mutex [private] |
Definition at line 82 of file ScopedMutexLock.h.