MySQL 8.0.39
Source Code Documentation
PolicyMutex< MutexImpl > Struct Template Reference

Mutex interface for all policy mutexes. More...

#include <ib0mutex.h>

Public Types

typedef MutexImpl MutexType
 
typedef MutexImpl::MutexPolicy Policy
 

Public Member Functions

 PolicyMutex () 1
 
 ~PolicyMutex ()=default
 
Policypolicy () 1
 
const Policypolicy () const 1
 
void exit () 1
 Release the mutex. More...
 
void enter (uint32_t n_spins, uint32_t n_delay, const char *name, uint32_t line) 1
 Acquire the mutex. More...
 
int trylock (const char *name, uint32_t line) 1
 Try and lock the mutex, return 0 on SUCCESS and 1 otherwise. More...
 
bool is_owned () const 1
 
void init (latch_id_t id, const char *filename, uint32_t line) 1
 Initialise the mutex. More...
 
void destroy () 1
 Free resources (if any) More...
 
 operator sys_mutex_t * () 1
 Required for os_event_t. More...
 
void pfs_add (mysql_pfs_key_t key) 1
 Performance schema monitoring - register mutex with PFS. More...
 

Private Member Functions

PSI_mutex_lockerpfs_begin_lock (PSI_mutex_locker_state *state, const char *name, uint32_t line) 1
 Performance schema monitoring. More...
 
PSI_mutex_lockerpfs_begin_trylock (PSI_mutex_locker_state *state, const char *name, uint32_t line) 1
 Performance schema monitoring. More...
 
void pfs_end (PSI_mutex_locker *locker, int ret) 1
 Performance schema monitoring. More...
 
void pfs_exit ()
 Performance schema monitoring - register mutex release. More...
 
void pfs_del ()
 Performance schema monitoring - deregister. More...
 

Private Attributes

MutexImpl m_impl
 The mutex implementation. More...
 
PSI_mutexm_ptr
 The performance schema instrumentation hook. More...
 

Detailed Description

template<typename MutexImpl>
struct PolicyMutex< MutexImpl >

Mutex interface for all policy mutexes.

This class handles the interfacing with the Performance Schema instrumentation.

Member Typedef Documentation

◆ MutexType

template<typename MutexImpl >
typedef MutexImpl PolicyMutex< MutexImpl >::MutexType

◆ Policy

template<typename MutexImpl >
typedef MutexImpl::MutexPolicy PolicyMutex< MutexImpl >::Policy

Constructor & Destructor Documentation

◆ PolicyMutex()

template<typename MutexImpl >
PolicyMutex< MutexImpl >::PolicyMutex ( )
inline

◆ ~PolicyMutex()

template<typename MutexImpl >
PolicyMutex< MutexImpl >::~PolicyMutex ( )
default

Member Function Documentation

◆ destroy()

template<typename MutexImpl >
void PolicyMutex< MutexImpl >::destroy ( )
inline

Free resources (if any)

◆ enter()

template<typename MutexImpl >
void PolicyMutex< MutexImpl >::enter ( uint32_t  n_spins,
uint32_t  n_delay,
const char *  name,
uint32_t  line 
)
inline

Acquire the mutex.

Parameters
n_spinsmax number of spins
n_delaymax delay per spin
namefilename where locked
lineline number where locked

◆ exit()

template<typename MutexImpl >
void PolicyMutex< MutexImpl >::exit ( )
inline

Release the mutex.

◆ init()

template<typename MutexImpl >
void PolicyMutex< MutexImpl >::init ( latch_id_t  id,
const char *  filename,
uint32_t  line 
)
inline

Initialise the mutex.

Parameters
[in]idMutex ID
[in]filenamefile where created
[in]lineline number in file where created

◆ is_owned()

template<typename MutexImpl >
bool PolicyMutex< MutexImpl >::is_owned ( ) const
inline
Returns
true if the thread owns the mutex.

◆ operator sys_mutex_t *()

template<typename MutexImpl >
PolicyMutex< MutexImpl >::operator sys_mutex_t * ( )
inline

Required for os_event_t.

◆ pfs_add()

template<typename MutexImpl >
void PolicyMutex< MutexImpl >::pfs_add ( mysql_pfs_key_t  key)
inline

Performance schema monitoring - register mutex with PFS.

Note: This is public only because we want to get around an issue with registering a subset of buffer pool pages with PFS when PFS_GROUP_BUFFER_SYNC is defined. Therefore this has to then be called by external code (see buf0buf.cc).

Parameters
key- Performance Schema key.

◆ pfs_begin_lock()

template<typename MutexImpl >
PSI_mutex_locker * PolicyMutex< MutexImpl >::pfs_begin_lock ( PSI_mutex_locker_state state,
const char *  name,
uint32_t  line 
)
inlineprivate

Performance schema monitoring.

Parameters
state- PFS locker state
name- file name where locked
line- line number in file where locked

◆ pfs_begin_trylock()

template<typename MutexImpl >
PSI_mutex_locker * PolicyMutex< MutexImpl >::pfs_begin_trylock ( PSI_mutex_locker_state state,
const char *  name,
uint32_t  line 
)
inlineprivate

Performance schema monitoring.

Parameters
state- PFS locker state
name- file name where locked
line- line number in file where locked

◆ pfs_del()

template<typename MutexImpl >
void PolicyMutex< MutexImpl >::pfs_del ( )
inlineprivate

Performance schema monitoring - deregister.

◆ pfs_end()

template<typename MutexImpl >
void PolicyMutex< MutexImpl >::pfs_end ( PSI_mutex_locker locker,
int  ret 
)
inlineprivate

Performance schema monitoring.

Parameters
locker- PFS identifier
ret- 0 for success and 1 for failure

◆ pfs_exit()

template<typename MutexImpl >
void PolicyMutex< MutexImpl >::pfs_exit ( )
inlineprivate

Performance schema monitoring - register mutex release.

◆ policy() [1/2]

template<typename MutexImpl >
Policy & PolicyMutex< MutexImpl >::policy ( )
inline
Returns
non-const version of the policy

◆ policy() [2/2]

template<typename MutexImpl >
const Policy & PolicyMutex< MutexImpl >::policy ( ) const
inline
Returns
const version of the policy

◆ trylock()

template<typename MutexImpl >
int PolicyMutex< MutexImpl >::trylock ( const char *  name,
uint32_t  line 
)
inline

Try and lock the mutex, return 0 on SUCCESS and 1 otherwise.

Parameters
namefilename where locked
lineline number where locked

Member Data Documentation

◆ m_impl

template<typename MutexImpl >
MutexImpl PolicyMutex< MutexImpl >::m_impl
private

The mutex implementation.

◆ m_ptr

template<typename MutexImpl >
PSI_mutex* PolicyMutex< MutexImpl >::m_ptr
private

The performance schema instrumentation hook.


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