MySQL 8.0.40
Source Code Documentation
|
RAII class to acquire a lock for the duration of a block. More...
#include <rpl_gtid.h>
Public Member Functions | |
Guard (Checkable_rwlock &lock, enum_lock_type lock_type) | |
Create a guard, and optionally acquire a lock on it. More... | |
Guard (Checkable_rwlock &lock, enum_lock_type lock_type, std::adopt_lock_t t) | |
Create a guard, assuming the caller already holds a lock on it. More... | |
Guard (Guard const ©)=delete | |
Objects of this class should not be copied or moved. More... | |
Guard (Guard const &©)=delete | |
~Guard () | |
Unlock on destruct. More... | |
void | rdlock () |
Acquire the read lock. More... | |
void | wrlock () |
Acquire the write lock. More... | |
int | trywrlock () |
Try to acquire the write lock, and fail if it cannot be immediately granted. More... | |
int | tryrdlock () |
Try to acquire a read lock, and fail if it cannot be immediately granted. More... | |
void | unlock () |
Unlock the lock. More... | |
void | unlock_if_locked () |
Unlock the lock, if it was acquired by this guard. More... | |
Checkable_rwlock & | get_lock () const |
Return the underlying Checkable_rwlock object. More... | |
bool | is_rdlocked () const |
Return true if this object is read locked. More... | |
bool | is_wrlocked () const |
Return true if this object is write locked. More... | |
bool | is_locked () const |
Return true if this object is either read locked or write locked. More... | |
Private Attributes | |
Checkable_rwlock & | m_lock |
enum_lock_type | m_lock_type |
RAII class to acquire a lock for the duration of a block.
|
inline |
Create a guard, and optionally acquire a lock on it.
|
inline |
Create a guard, assuming the caller already holds a lock on it.
|
delete |
Objects of this class should not be copied or moved.
|
delete |
|
inline |
Unlock on destruct.
|
inline |
Return the underlying Checkable_rwlock object.
|
inline |
Return true if this object is either read locked or write locked.
|
inline |
Return true if this object is read locked.
|
inline |
Return true if this object is write locked.
|
inline |
Acquire the read lock.
|
inline |
Try to acquire a read lock, and fail if it cannot be immediately granted.
|
inline |
Try to acquire the write lock, and fail if it cannot be immediately granted.
|
inline |
Unlock the lock.
|
inline |
Unlock the lock, if it was acquired by this guard.
|
inline |
Acquire the write lock.
|
private |
|
private |