MySQL 26.7.0
Source Code Documentation
mysql::csa::Module Class Reference

Represents a lockable module. More...

#include <module.h>

Inheritance diagram for mysql::csa::Module:
[legend]

Public Types

enum class  State { off = 0 , on , start , stop }
 Enum defining possible states of the module. More...
 
using Lock_guard = Lock_guard_object< Module >
 

Public Member Functions

 Module (PSI_mutex_key mutex_key, PSI_rwlock_key rwlock_key)
 Constructs the module. More...
 
virtual ~Module () override
 Destructor. More...
 
void init_locking ()
 Initializes internal locking. More...
 
bool init () override
 Initializes the module. More...
 
Lock_guard rdlock ()
 Acquires a read lock on this object. More...
 
Lock_guard wrlock ()
 Acquires a write lock on this object. More...
 
bool deinit () override
 Deinitializes the module. More...
 
bool is_inited ()
 Checks if the module is initialized. More...
 
- Public Member Functions inherited from mysql::csa::Initable
virtual ~Initable ()=default
 Destructor. More...
 

Protected Member Functions

void unlock ()
 Unlocks this module. More...
 
virtual bool do_init ()
 Initialization hook for derived classes. More...
 
virtual bool do_deinit ()
 Deinitialization hook for derived classes. More...
 

Private Attributes

PSI_rwlock_key m_rwlock_key
 PSI key for the read-write lock. More...
 
mysql_rwlock_t m_rwlock
 Read-write lock for the module. More...
 
std::atomic< Statem_inited {State::off}
 State of the module. More...
 

Friends

class Lock_guard_object< Module >
 

Detailed Description

Represents a lockable module.

Member Typedef Documentation

◆ Lock_guard

Member Enumeration Documentation

◆ State

enum class mysql::csa::Module::State
strong

Enum defining possible states of the module.

Enumerator
off 
on 
start 
stop 

Constructor & Destructor Documentation

◆ Module()

mysql::csa::Module::Module ( PSI_mutex_key  mutex_key,
PSI_rwlock_key  rwlock_key 
)

Constructs the module.

Parameters
mutex_keyPSI mutex key
rwlock_keyPSI rwlock key

◆ ~Module()

mysql::csa::Module::~Module ( )
overridevirtual

Destructor.

Member Function Documentation

◆ deinit()

bool mysql::csa::Module::deinit ( )
overridevirtual

Deinitializes the module.

Returns
True on error, false on success

Implements mysql::csa::Initable.

◆ do_deinit()

bool mysql::csa::Module::do_deinit ( )
protectedvirtual

Deinitialization hook for derived classes.

Returns
True on error, false on success

Reimplemented in mysql::csa::Csa_service.

◆ do_init()

bool mysql::csa::Module::do_init ( )
protectedvirtual

Initialization hook for derived classes.

Returns
True on error, false on success

Reimplemented in mysql::csa::Csa_service.

◆ init()

bool mysql::csa::Module::init ( )
overridevirtual

Initializes the module.

Returns
True on error, false on success

Implements mysql::csa::Initable.

◆ init_locking()

void mysql::csa::Module::init_locking ( )

Initializes internal locking.

◆ is_inited()

bool mysql::csa::Module::is_inited ( )

Checks if the module is initialized.

Returns
True if initialized, false otherwise

◆ rdlock()

Module::Lock_guard mysql::csa::Module::rdlock ( )

Acquires a read lock on this object.

Returns
Scope guard that unlocks at the end of the scope

◆ unlock()

void mysql::csa::Module::unlock ( )
protected

Unlocks this module.

◆ wrlock()

Module::Lock_guard mysql::csa::Module::wrlock ( )

Acquires a write lock on this object.

Returns
Scope guard that unlocks at the end of the scope

Friends And Related Function Documentation

◆ Lock_guard_object< Module >

friend class Lock_guard_object< Module >
friend

Member Data Documentation

◆ m_inited

std::atomic<State> mysql::csa::Module::m_inited {State::off}
private

State of the module.

◆ m_rwlock

mysql_rwlock_t mysql::csa::Module::m_rwlock
private

Read-write lock for the module.

◆ m_rwlock_key

PSI_rwlock_key mysql::csa::Module::m_rwlock_key
private

PSI key for the read-write lock.


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