Public Types | Public Member Functions | Private Attributes | List of all members
icl_core::thread::ScopedRWLock Class Reference

Manages locking and unlocking of a read-write lock. More...

#include <ScopedRWLock.h>

Inheritance diagram for icl_core::thread::ScopedRWLock:
Inheritance graph
[legend]

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
 
RWLockm_lock
 

Additional Inherited Members

- Protected Member Functions inherited from icl_core::Noncopyable
 Noncopyable ()
 
virtual ~Noncopyable ()
 

Detailed Description

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.

Member Enumeration Documentation

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.

Constructor & Destructor Documentation

icl_core::thread::ScopedRWLock::ScopedRWLock ( RWLock lock,
LockMode  lock_mode,
bool  force = true 
)
explicit

Locks the read-write lock.

Parameters
lockThe read-write lock to use.
lock_modeUse eLM_READ_LOCK for a read lock, and eLM_WRITE_LOCK for a write lock.
forceEnsure 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.

Member Function Documentation

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.

Member Data Documentation

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.


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


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:59