MySQL 8.4.2
Source Code Documentation
mysql_harness::MySQLRouterThread Class Reference

MySQLRouterThread provides higher level interface to managing threads. More...

#include <mysql_router_thread.h>

Public Types

using thread_function = void *(void *)
 

Public Member Functions

 MySQLRouterThread (size_t thread_stack_size=mysql_harness::kDefaultStackSizeInKiloBytes)
 Allocates memory for thread of execution. More...
 
void run (thread_function run_thread, void *args_ptr, bool detach=false)
 Execute run_thread function in thread of execution. More...
 
void join ()
 Waits for a thread to finish its execution. More...
 
 ~MySQLRouterThread ()
 Waits for a thread to finish its execution if thread is joinable and join wasn't called. More...
 
MySQLRouterThreadoperator= (const MySQLRouterThread &)=delete
 
 MySQLRouterThread (const MySQLRouterThread &)=delete
 

Private Attributes

mysql_harness::mysql_router_thread_handle thread_handle_
 handle to the thread More...
 
mysql_harness::mysql_router_thread_attr_t thread_attr_
 attribute of thread More...
 
bool should_join_ = false
 true if thread is joinable but join wasn't called, false otherwise More...
 

Detailed Description

MySQLRouterThread provides higher level interface to managing threads.

Member Typedef Documentation

◆ thread_function

Constructor & Destructor Documentation

◆ MySQLRouterThread() [1/2]

mysql_harness::MySQLRouterThread::MySQLRouterThread ( size_t  thread_stack_size = mysql_harness::kDefaultStackSizeInKiloBytes)

Allocates memory for thread of execution.

Parameters
thread_stack_sizethe memory size allocated to thread's stack
Exceptions
std::runtime_errorif cannot adjust thread size

◆ ~MySQLRouterThread()

mysql_harness::MySQLRouterThread::~MySQLRouterThread ( )

Waits for a thread to finish its execution if thread is joinable and join wasn't called.

◆ MySQLRouterThread() [2/2]

mysql_harness::MySQLRouterThread::MySQLRouterThread ( const MySQLRouterThread )
explicitdelete

Member Function Documentation

◆ join()

void mysql_harness::MySQLRouterThread::join ( )

Waits for a thread to finish its execution.

◆ operator=()

MySQLRouterThread & mysql_harness::MySQLRouterThread::operator= ( const MySQLRouterThread )
delete

◆ run()

void mysql_harness::MySQLRouterThread::run ( thread_function  run_thread,
void *  args_ptr,
bool  detach = false 
)

Execute run_thread function in thread of execution.

Parameters
run_threadthe pointer to the function that is executed in thread. It has to be non-member void*(void*) function
args_ptrpointer to run_thread parameter
detachtrue if thread is detached, false if thread is joinable
Exceptions
std::runtime_errorif cannot create new thread of execution

Member Data Documentation

◆ should_join_

bool mysql_harness::MySQLRouterThread::should_join_ = false
private

true if thread is joinable but join wasn't called, false otherwise

◆ thread_attr_

mysql_harness::mysql_router_thread_attr_t mysql_harness::MySQLRouterThread::thread_attr_
private

attribute of thread

◆ thread_handle_

mysql_harness::mysql_router_thread_handle mysql_harness::MySQLRouterThread::thread_handle_
private

handle to the thread


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