MySQL 8.4.2
Source Code Documentation
THD_ptr Class Reference

This class encapsulates THD instance, controls access to the actual THD. More...

#include <mysqld_thd_manager.h>

Public Member Functions

 THD_ptr ()=default
 Default class constructor. More...
 
 THD_ptr (THD *thd)
 Constructor assigns THD instance to manage and acquires THD::LOCK_thd_data mutex. More...
 
 THD_ptr (THD_ptr const &)=delete
 Delete copy constructor, THD_ptr copy is not allowed. More...
 
 THD_ptr (THD_ptr &&thd_ptr)
 Move constructor. More...
 
 ~THD_ptr ()
 Destructor to release underlying THD instance's control and release mutex THD::LOCK_thd_data. More...
 
THDrelease ()
 Release underlying THD instance's control and release THD::LOCK_thd_data. More...
 
THD_ptroperator= (THD_ptr const &)=delete
 Delete copy operator, THD_ptr copy is not allowed. More...
 
THD_ptroperator= (THD_ptr &&thd_ptr)
 Move semantics assignment operator. More...
 
THDget ()
 Access underlying THD instance. More...
 
THDoperator-> ()
 Access underlying THD instance. More...
 
THDoperator* ()
 Access underlying THD instance. More...
 
 operator bool () const
 Check if there is an underlying THD instance. More...
 
bool operator== (std::nullptr_t) const
 Compare underlying THD pointer value with the "nullptr". More...
 
bool operator== (THD const *thd_ptr) const
 Compare this instance with other THD_ptr instance. More...
 
bool operator!= (std::nullptr_t) const
 Compare underlying THD pointer value with the "nullptr". More...
 
bool operator!= (THD const *thd_ptr) const
 Compare this instance with other THD_ptr instance. More...
 

Private Attributes

THDm_underlying {nullptr}
 

Detailed Description

This class encapsulates THD instance, controls access to the actual THD.

It also ensures that THD::LOCK_thd_data mutex is acquired at instantiation and released at destruction.

Constructor & Destructor Documentation

◆ THD_ptr() [1/4]

THD_ptr::THD_ptr ( )
default

Default class constructor.

◆ THD_ptr() [2/4]

THD_ptr::THD_ptr ( THD thd)
explicit

Constructor assigns THD instance to manage and acquires THD::LOCK_thd_data mutex.

Parameters
thdTHD instance.

◆ THD_ptr() [3/4]

THD_ptr::THD_ptr ( THD_ptr const &  )
delete

Delete copy constructor, THD_ptr copy is not allowed.

◆ THD_ptr() [4/4]

THD_ptr::THD_ptr ( THD_ptr &&  thd_ptr)

Move constructor.

Parameters
thd_ptrTHD_ptr instance to collect underlying THD instance.

◆ ~THD_ptr()

THD_ptr::~THD_ptr ( )
inline

Destructor to release underlying THD instance's control and release mutex THD::LOCK_thd_data.

Member Function Documentation

◆ get()

THD * THD_ptr::get ( )
inline

Access underlying THD instance.

returns pointer to underlying THD instance.

◆ operator bool()

THD_ptr::operator bool ( ) const
inline

Check if there is an underlying THD instance.

◆ operator!=() [1/2]

bool THD_ptr::operator!= ( std::nullptr_t  ) const
inline

Compare underlying THD pointer value with the "nullptr".

Returns
true if underlying THD pointer value not equals nullptr.

◆ operator!=() [2/2]

bool THD_ptr::operator!= ( THD const *  thd_ptr) const
inline

Compare this instance with other THD_ptr instance.

Parameters
thd_ptrOther THD_ptr instance for comparison.
Returns
true if this instance differs from other THD_ptr instance.

◆ operator*()

THD & THD_ptr::operator* ( )
inline

Access underlying THD instance.

returns reference to underlying THD instance.

◆ operator->()

THD * THD_ptr::operator-> ( )
inline

Access underlying THD instance.

returns pointer to underlying THD instance.

◆ operator=() [1/2]

THD_ptr & THD_ptr::operator= ( THD_ptr &&  thd_ptr)

Move semantics assignment operator.

Parameters
thd_ptrTHD_ptr instance to collect underlying THD instance.

◆ operator=() [2/2]

THD_ptr & THD_ptr::operator= ( THD_ptr const &  )
delete

Delete copy operator, THD_ptr copy is not allowed.

◆ operator==() [1/2]

bool THD_ptr::operator== ( std::nullptr_t  ) const
inline

Compare underlying THD pointer value with the "nullptr".

Returns
true if underlying THD pointer value equals "nullptr".

◆ operator==() [2/2]

bool THD_ptr::operator== ( THD const *  thd_ptr) const
inline

Compare this instance with other THD_ptr instance.

Parameters
thd_ptrOther THD_ptr instance for comparison.
Returns
true if this instance equals other THD_ptr instance.

◆ release()

THD * THD_ptr::release ( )

Release underlying THD instance's control and release THD::LOCK_thd_data.

Returns
underlying THD instance.

Member Data Documentation

◆ m_underlying

THD* THD_ptr::m_underlying {nullptr}
private

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