MySQL 9.1.0
Source Code Documentation
Generic_mutex_lock< MUTEX > Class Template Reference

A simple wrapper around a mutex: Grabs the mutex in the CTOR, releases it in the DTOR. More...

#include <mutex_lock.h>

Public Member Functions

 Generic_mutex_lock () noexcept=default
 
 Generic_mutex_lock (MUTEX *mutex, const char *src_file, int src_line) noexcept
 
 ~Generic_mutex_lock () noexcept
 
 Generic_mutex_lock (const Generic_mutex_lock &)=delete
 
 Generic_mutex_lock (Generic_mutex_lock &&src) noexcept
 
Generic_mutex_lockoperator= (const Generic_mutex_lock &)=delete
 
Generic_mutex_lockoperator= (Generic_mutex_lock &&src) noexcept
 

Private Attributes

MUTEX * m_mutex = nullptr
 
const char * m_src_file = nullptr
 
int m_src_line = 0
 

Detailed Description

template<class MUTEX>
class Generic_mutex_lock< MUTEX >

A simple wrapper around a mutex: Grabs the mutex in the CTOR, releases it in the DTOR.

The mutex may be NULL, in which case this is a no-op. Templated to allow unit testing with mocked mutex. Not copyable since ownership of a mutex cannot be shared, but movable so that ownership can be transferred to a different Mutex_lock.

Constructor & Destructor Documentation

◆ Generic_mutex_lock() [1/4]

template<class MUTEX >
Generic_mutex_lock< MUTEX >::Generic_mutex_lock ( )
defaultnoexcept

◆ Generic_mutex_lock() [2/4]

template<class MUTEX >
Generic_mutex_lock< MUTEX >::Generic_mutex_lock ( MUTEX *  mutex,
const char *  src_file,
int  src_line 
)
inlinenoexcept

◆ ~Generic_mutex_lock()

template<class MUTEX >
Generic_mutex_lock< MUTEX >::~Generic_mutex_lock ( )
inlinenoexcept

◆ Generic_mutex_lock() [3/4]

template<class MUTEX >
Generic_mutex_lock< MUTEX >::Generic_mutex_lock ( const Generic_mutex_lock< MUTEX > &  )
delete

◆ Generic_mutex_lock() [4/4]

template<class MUTEX >
Generic_mutex_lock< MUTEX >::Generic_mutex_lock ( Generic_mutex_lock< MUTEX > &&  src)
inlinenoexcept

Member Function Documentation

◆ operator=() [1/2]

template<class MUTEX >
Generic_mutex_lock & Generic_mutex_lock< MUTEX >::operator= ( const Generic_mutex_lock< MUTEX > &  )
delete

◆ operator=() [2/2]

template<class MUTEX >
Generic_mutex_lock & Generic_mutex_lock< MUTEX >::operator= ( Generic_mutex_lock< MUTEX > &&  src)
inlinenoexcept

Member Data Documentation

◆ m_mutex

template<class MUTEX >
MUTEX* Generic_mutex_lock< MUTEX >::m_mutex = nullptr
private

◆ m_src_file

template<class MUTEX >
const char* Generic_mutex_lock< MUTEX >::m_src_file = nullptr
private

◆ m_src_line

template<class MUTEX >
int Generic_mutex_lock< MUTEX >::m_src_line = 0
private

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