Used to lock a particular variable for reading.
More...
|
| | 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 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.
|
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.
◆ 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] | lock | The 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
-
◆ RLock() [3/6]
Constructs a read lock on the given RWLock.
- Parameters
-
| [in] | lock | The 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] | lock | The pointer key used to look up the RWLock. |
| [in] | timeout | The 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] | lock | The pointer key used to look up the RWLock. |
| [out] | didAquire | Set 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] | lock | The RLock to move from. |
References RLock().
◆ ~RLock()
Destructor.
Releases the read lock if held.
◆ HasLock() [1/2]
| bool RLock::HasLock |
( |
const RWLock & | lock | ) |
|
|
static |
Checks whether a read lock is currently held on the given RWLock.
- Parameters
-
- 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] | lock | The 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: