MySQL 26.7.0
Source Code Documentation
Atomic_sysvar< T > Class Template Reference

A helper class for numeric sysvars which can be read in thread-safe way. More...

#include <ut0atomic_sysvar.h>

Classes

struct  Data
 Contains all members of Atomic_sysvar<T> in a standard layout struct - which, among other things, means we can't mix private with public, use virtual methods, nor std::function<>. More...
 

Public Member Functions

 Atomic_sysvar (void(*after_change)())
 Constructs the atomic sysvar, initializes its value to zero and makes sure innodb_init_params() will remember to copy the nonatomic value to atomic value once Server layer finishes modifying the nonatomic value during its initialization. More...
 
T load () const
 Get the current value of the sys-var without UB. More...
 
Tregistrable ()
 Get the variable which we want to register via plugin API. More...
 

Static Public Member Functions

static void update (THD *, SYS_VAR *, void *target, const void *new_value)
 This is on-update handler registered via plugin API for all sysvars of this type. More...
 

Private Attributes

struct Atomic_sysvar::Data m_data
 

Detailed Description

template<typename T>
class Atomic_sysvar< T >

A helper class for numeric sysvars which can be read in thread-safe way.

Constructor & Destructor Documentation

◆ Atomic_sysvar()

template<typename T >
Atomic_sysvar< T >::Atomic_sysvar ( void(*)()  after_change)
inlineexplicit

Constructs the atomic sysvar, initializes its value to zero and makes sure innodb_init_params() will remember to copy the nonatomic value to atomic value once Server layer finishes modifying the nonatomic value during its initialization.

Parameters
[in]after_changeA callback to be called after value changed due to SET or recovery of value stored with SET PERSIST.

Member Function Documentation

◆ load()

template<typename T >
T Atomic_sysvar< T >::load ( ) const
inline

Get the current value of the sys-var without UB.

◆ registrable()

template<typename T >
T & Atomic_sysvar< T >::registrable ( )
inline

Get the variable which we want to register via plugin API.

Do not use this method in InnoDB code - use load() instead.

◆ update()

template<typename T >
static void Atomic_sysvar< T >::update ( THD ,
SYS_VAR ,
void *  target,
const void *  new_value 
)
inlinestatic

This is on-update handler registered via plugin API for all sysvars of this type.

It is called after new value was validated, but before it was assigned. It is the responsibility of this function to assign new_value to target.

Parameters
[in]targetThis points to Data::m_nonatomic
[in]new_valueThis is the new value to be assigned to the sysvar

Member Data Documentation

◆ m_data

template<typename T >
struct Atomic_sysvar::Data Atomic_sysvar< T >::m_data
private

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