MySQL 9.1.0
Source Code Documentation
|
Sentry class for Shared_spin_lock
to deliver RAII pattern usability.
More...
#include <shared_spin_lock.h>
Public Member Functions | |
Guard (Shared_spin_lock &target, enum_lock_acquisition acquisition=enum_lock_acquisition::SL_SHARED, bool try_and_fail=false) | |
Class constructor that receives the target spin-lock, whether or not it can be a shared acquisition and whether or not it should be a try-and-fail lock attempt, instead of a blocking attempt. More... | |
Guard (Shared_spin_lock::Guard const &)=delete | |
Guard (Shared_spin_lock::Guard &&)=delete | |
virtual | ~Guard () |
Destructor for the sentry. More... | |
Shared_spin_lock::Guard & | operator= (Shared_spin_lock::Guard const &)=delete |
Shared_spin_lock::Guard & | operator= (Shared_spin_lock::Guard &&)=delete |
Shared_spin_lock * | operator-> () |
Arrow operator to access the underlying lock. More... | |
Shared_spin_lock & | operator* () |
Star operator to access the underlying lock. More... | |
Shared_spin_lock::Guard & | acquire (enum_lock_acquisition acquisition, bool try_and_fail=false) |
If this instance was initialized without acquiring the lock (NO_ACQUISITION passed to constructor) or the acquisition request wasn't granted (passing try_and_fail = true to the constructor), invoking this method will try to acquire the lock in the provided mode. More... | |
Shared_spin_lock::Guard & | release () |
Releases the underlying lock acquisition, if any. More... | |
Private Attributes | |
Shared_spin_lock & | m_target |
The underlying lock. More... | |
enum_lock_acquisition | m_acquisition {enum_lock_acquisition::SL_SHARED} |
The type of lock acquisition to be requested. More... | |
Friends | |
class | Shared_spin_lock |
Sentry class for Shared_spin_lock
to deliver RAII pattern usability.
lock::Shared_spin_lock::Guard::Guard | ( | lock::Shared_spin_lock & | target, |
enum_lock_acquisition | acquisition = enum_lock_acquisition::SL_SHARED , |
||
bool | try_and_fail = false |
||
) |
Class constructor that receives the target spin-lock, whether or not it can be a shared acquisition and whether or not it should be a try-and-fail lock attempt, instead of a blocking attempt.
target | The target spin-lock. |
acquisition | the acquisition type, SHARED, EXCLUSIVE or NO_ACQUISITION |
try_and_fail | whether or not the lock attempt should be blocking (only used if acquisition type is SHARED or EXCLUSIVE). |
|
delete |
|
delete |
|
virtual |
Destructor for the sentry.
It will release any acquisition, shared or exclusive.
lock::Shared_spin_lock::Guard & lock::Shared_spin_lock::Guard::acquire | ( | enum_lock_acquisition | acquisition, |
bool | try_and_fail = false |
||
) |
If this instance was initialized without acquiring the lock (NO_ACQUISITION
passed to constructor) or the acquisition request wasn't granted (passing try_and_fail = true
to the constructor), invoking this method will try to acquire the lock in the provided mode.
acquisition | the acquisition type, SHARED or EXCLUSIVE |
try_and_fail | whether or not the lock attempt should be blocking |
this
object, for chaining purposes. lock::Shared_spin_lock & lock::Shared_spin_lock::Guard::operator* | ( | ) |
Star operator to access the underlying lock.
lock::Shared_spin_lock * lock::Shared_spin_lock::Guard::operator-> | ( | ) |
Arrow operator to access the underlying lock.
|
delete |
|
delete |
lock::Shared_spin_lock::Guard & lock::Shared_spin_lock::Guard::release | ( | ) |
Releases the underlying lock acquisition, if any.
this
object, for chaining purposes.
|
friend |
|
private |
The type of lock acquisition to be requested.
|
private |
The underlying lock.