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 |
Additional Inherited Members | |
Protected Member Functions inherited from icl_core::Noncopyable | |
Noncopyable () | |
virtual | ~Noncopyable () |
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.
Enumerator | |
---|---|
eLM_READ_LOCK |
Obtain a read lock. |
eLM_WRITE_LOCK |
Obtain a write lock. |
Definition at line 54 of file ScopedRWLock.h.
|
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.
icl_core::thread::ScopedRWLock::~ScopedRWLock | ( | ) |
Unlocks the read-write lock.
Definition at line 43 of file ScopedRWLock.cpp.
|
inline |
Check if the read-write lock has been successfully locked.
Definition at line 74 of file ScopedRWLock.h.
|
inline |
Implicit conversion to bool.
Definition at line 79 of file ScopedRWLock.h.
|
private |
Definition at line 94 of file ScopedRWLock.h.
|
private |
Definition at line 93 of file ScopedRWLock.h.