Used to lock a particular variable for writing.
More...
|
| | WLock (const UUID &lock) |
| | Constructs a write lock by looking up the RWLock associated with the given UUID.
|
| | WLock (const void *lock) |
| | Constructs a write lock by looking up the RWLock associated with the given pointer.
|
| | WLock (const void *lock, const TimeSpan &timeout) |
| | Constructs a write lock with a TimeSpan timeout, looking up the RWLock by pointer.
|
| | WLock (const void *lock, uint08 timeout) |
| | Constructs a write lock with a timeout, looking up the RWLock by pointer.
|
| | WLock (RWLock &lock) |
| | Constructs a write lock on the given RWLock.
|
| | WLock (WLock &&lock) noexcept |
| | Move constructor.
|
| | ~WLock () |
| | Destructor.
|
| bool | isLocked () const |
| | Returns whether this WLock currently holds a write lock.
|
|
| static bool | HasLock (const RWLock &lock) |
| | Checks whether a write lock is currently held on the given RWLock.
|
| static bool | HasLock (const void *lock) |
| | Checks whether a write lock is currently held for the given pointer.
|
Used to lock a particular variable for writing.
Only one write lock can be created when no read locks are on a variable, otherwise will wait. Note: Automatically unlocks on destruction.
- See also
- RWLock, RLock, MultiWLock
Definition at line 271 of file RWLock.h.
◆ WLock() [1/6]
| WLock::WLock |
( |
const void * | lock | ) |
|
|
explicit |
Constructs a write 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 WLock().
◆ WLock() [2/6]
| WLock::WLock |
( |
const UUID & | lock | ) |
|
|
explicit |
Constructs a write lock by looking up the RWLock associated with the given UUID.
- Parameters
-
◆ WLock() [3/6]
Constructs a write lock on the given RWLock.
- Parameters
-
| [in] | lock | The RWLock to acquire a write lock on. |
◆ WLock() [4/6]
| WLock::WLock |
( |
WLock && | lock | ) |
|
|
noexcept |
Move constructor.
Transfers lock ownership from another WLock.
- Parameters
-
| [in] | lock | The WLock to move from. |
References WLock().
◆ WLock() [5/6]
| WLock::WLock |
( |
const void * | lock, |
|
|
uint08 | timeout ) |
Constructs a write 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. |
◆ WLock() [6/6]
| WLock::WLock |
( |
const void * | lock, |
|
|
const TimeSpan & | timeout ) |
Constructs a write lock with a TimeSpan timeout, looking up the RWLock by pointer.
- Parameters
-
| [in] | lock | The pointer key used to look up the RWLock. |
| [in] | timeout | The maximum duration to wait for the lock. |
◆ ~WLock()
Destructor.
Releases the write lock if held.
◆ HasLock() [1/2]
| bool WLock::HasLock |
( |
const RWLock & | lock | ) |
|
|
static |
Checks whether a write lock is currently held on the given RWLock.
- Parameters
-
- Returns
- True if a write lock is held.
◆ HasLock() [2/2]
| bool WLock::HasLock |
( |
const void * | lock | ) |
|
|
static |
Checks whether a write lock is currently held for the given pointer.
- Parameters
-
| [in] | lock | The pointer key to check. |
- Returns
- True if a write lock is held for the entry.
◆ isLocked()
| bool WLock::isLocked |
( |
| ) |
const |
Returns whether this WLock currently holds a write lock.
- Returns
- True if the lock is held.
The documentation for this class was generated from the following file: