NDEVR
API Documentation

Used to lock a particular variable for reading. More...

Public Member Functions

 RLock (const UUID &lock)
 Constructs a read lock by looking up the RWLock associated with the given UUID.
 RLock (const void *lock)
 Constructs a read lock by looking up the RWLock associated with the given pointer.
 RLock (const void *lock, bool &didAquire)
 Attempts to construct a read lock, reporting whether acquisition succeeded.
 RLock (const void *lock, uint08 timeout)
 Constructs a read lock with a timeout, looking up the RWLock by pointer.
 RLock (RLock &&lock) noexcept
 Move constructor.
 RLock (RWLock &lock)
 Constructs a read lock on the given RWLock.
 ~RLock ()
 Destructor.
bool isLocked () const
 Returns whether this RLock currently holds a read lock.

Static Public Member Functions

static bool HasLock (const RWLock &lock)
 Checks whether a read lock is currently held on the given RWLock.
static bool HasLock (const void *lock)
 Checks whether a read lock is currently held for the given pointer.

Detailed Description

Used to lock a particular variable for reading.


Any number of readers can be created when no write locks are on a variable, otherwise will wait.

Note: Automatically unlocks on destruction.

See also
RWLock, WLock, MultiRLock

Definition at line 156 of file RWLock.h.

Constructor & Destructor Documentation

◆ RLock() [1/6]

RLock::RLock ( const void * lock)
explicit

Constructs a read lock by looking up the RWLock associated with the given pointer.

Parameters
[in]lockThe pointer key used to look up the RWLock.

Referenced by RLock(), and isLocked().

◆ RLock() [2/6]

RLock::RLock ( const UUID & lock)
explicit

Constructs a read lock by looking up the RWLock associated with the given UUID.

Parameters
[in]lockThe UUID key used to look up the RWLock.

◆ RLock() [3/6]

RLock::RLock ( RWLock & lock)
explicit

Constructs a read lock on the given RWLock.

Parameters
[in]lockThe RWLock to acquire a read lock on.

◆ RLock() [4/6]

RLock::RLock ( const void * lock,
uint08 timeout )

Constructs a read lock with a timeout, looking up the RWLock by pointer.

Parameters
[in]lockThe pointer key used to look up the RWLock.
[in]timeoutThe maximum time in nanoseconds to wait for the lock.

◆ RLock() [5/6]

RLock::RLock ( const void * lock,
bool & didAquire )

Attempts to construct a read lock, reporting whether acquisition succeeded.

Parameters
[in]lockThe pointer key used to look up the RWLock.
[out]didAquireSet to true if the lock was acquired, false otherwise.

◆ RLock() [6/6]

RLock::RLock ( RLock && lock)
noexcept

Move constructor.

Transfers lock ownership from another RLock.

Parameters
[in]lockThe RLock to move from.

References RLock().

◆ ~RLock()

RLock::~RLock ( )

Destructor.

Releases the read lock if held.

Member Function Documentation

◆ HasLock() [1/2]

bool RLock::HasLock ( const RWLock & lock)
static

Checks whether a read lock is currently held on the given RWLock.

Parameters
[in]lockThe RWLock to check.
Returns
True if a read lock is held.

◆ HasLock() [2/2]

bool RLock::HasLock ( const void * lock)
static

Checks whether a read lock is currently held for the given pointer.

Parameters
[in]lockThe pointer key to check.
Returns
True if a read lock is held for the entry.

◆ isLocked()

bool RLock::isLocked ( ) const

Returns whether this RLock currently holds a read lock.

Returns
True if the lock is held.

References RLock().


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