Manages locking and unlocking of a read-write lock. More...
#include <ScopedRWLock.h>

Public Types | |
| enum | LockMode { eLM_READ_LOCK, eLM_WRITE_LOCK } |
| The type of lock to obtain on the read-write lock. More... | |
Public Member Functions | |
| bool | isLocked () const |
| operator bool () const | |
| ScopedRWLock (RWLock &lock, LockMode lock_mode, bool force=true) | |
| ~ScopedRWLock () | |
Private Attributes | |
| bool | m_is_locked |
| RWLock & | m_lock |
Manages locking and unlocking of a read-write lock.
Locks or tries to lock a read-write lock in the constructor and unlocks it in the destructor.
Definition at line 50 of file ScopedRWLock.h.
The type of lock to obtain on the read-write lock.
Definition at line 54 of file ScopedRWLock.h.
| icl_core::thread::ScopedRWLock::ScopedRWLock | ( | RWLock & | lock, |
| LockMode | lock_mode, | ||
| bool | force = true |
||
| ) | [explicit] |
Locks the read-write lock.
| lock | The read-write lock to use. |
| lock_mode | Use eLM_READ_LOCK for a read lock, and eLM_WRITE_LOCK for a write lock. |
| force | Ensure at all cost that IsLocked() is true. |
Definition at line 30 of file ScopedRWLock.cpp.
Unlocks the read-write lock.
Definition at line 43 of file ScopedRWLock.cpp.
| bool icl_core::thread::ScopedRWLock::isLocked | ( | ) | const [inline] |
Check if the read-write lock has been successfully locked.
Definition at line 74 of file ScopedRWLock.h.
| icl_core::thread::ScopedRWLock::operator bool | ( | ) | const [inline] |
Implicit conversion to bool.
Definition at line 79 of file ScopedRWLock.h.
bool icl_core::thread::ScopedRWLock::m_is_locked [private] |
Definition at line 94 of file ScopedRWLock.h.
RWLock& icl_core::thread::ScopedRWLock::m_lock [private] |
Definition at line 93 of file ScopedRWLock.h.