MySQL 8.0.40
Source Code Documentation
Detached_thread Class Reference

Wrapper for a callable, it will count the number of registered Runnable instances and will register the thread executing the callable with the PFS and the Server threading infrastructure. More...

#include <os0thread-create.h>

Inheritance diagram for Detached_thread:
[legend]

Public Member Functions

 Detached_thread (mysql_pfs_key_t pfs_key, PSI_thread_seqnum pfs_seqnum)
 Constructor for the detached thread. More...
 
template<typename F , typename... Args>
void operator() (F &&f, Args &&...args)
 Method to execute the callable. More...
 
IB_thread thread () const
 
- Public Member Functions inherited from MySQL_thread
 MySQL_thread (mysql_pfs_key_t pfs_key, PSI_thread_seqnum pfs_seqnum)
 Constructor for the Runnable object. More...
 

Private Member Functions

void init ()
 Initializes the m_shared_future, uses the m_promise's get_future, which cannot be used since then, according to its documentation. More...
 
void preamble ()
 Register the thread with the server. More...
 
void epilogue ()
 Deregister the thread. More...
 

Private Attributes

IB_thread m_thread
 Future object which keeps the ref counter >= 1 at least as long as the Detached_thread is not-destroyed. More...
 
std::promise< void > m_promise
 Promise which is set when task is done. More...
 

Additional Inherited Members

- Protected Member Functions inherited from MySQL_thread
void preamble ()
 Register the thread with the server. More...
 
void epilogue ()
 Deregister the thread. More...
 
THDcreate_mysql_thd () noexcept
 
void destroy_mysql_thd (THD *thd) noexcept
 Destroy a THD instance. More...
 
- Protected Attributes inherited from MySQL_thread
const mysql_pfs_key_t m_pfs_key
 Performance schema key. More...
 
PSI_thread_seqnum m_pfs_seqnum
 Performance schema sequence number. More...
 

Detailed Description

Wrapper for a callable, it will count the number of registered Runnable instances and will register the thread executing the callable with the PFS and the Server threading infrastructure.

Constructor & Destructor Documentation

◆ Detached_thread()

Detached_thread::Detached_thread ( mysql_pfs_key_t  pfs_key,
PSI_thread_seqnum  pfs_seqnum 
)
inlineexplicit

Constructor for the detached thread.

Parameters
[in]pfs_keyPerformance schema key
[in]pfs_seqnumPerformance schema sequence number

Member Function Documentation

◆ epilogue()

void Detached_thread::epilogue ( )
inlineprivate

Deregister the thread.

◆ init()

void Detached_thread::init ( void  )
inlineprivate

Initializes the m_shared_future, uses the m_promise's get_future, which cannot be used since then, according to its documentation.

◆ operator()()

template<typename F , typename... Args>
void Detached_thread::operator() ( F &&  f,
Args &&...  args 
)
inline

Method to execute the callable.

Parameters
[in]fCallable object
[in]argsVariable number of args to F

◆ preamble()

void Detached_thread::preamble ( )
inlineprivate

Register the thread with the server.

◆ thread()

IB_thread Detached_thread::thread ( ) const
inline
Returns
thread handle.

Member Data Documentation

◆ m_promise

std::promise<void> Detached_thread::m_promise
private

Promise which is set when task is done.

◆ m_thread

IB_thread Detached_thread::m_thread
mutableprivate

Future object which keeps the ref counter >= 1 at least as long as the Detached_thread is not-destroyed.


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