MySQL 8.0.39
Source Code Documentation
|
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... | |
MySQLRouterThread & | operator= (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... | |
MySQLRouterThread provides higher level interface to managing threads.
using mysql_harness::MySQLRouterThread::thread_function = void *(void *) |
mysql_harness::MySQLRouterThread::MySQLRouterThread | ( | size_t | thread_stack_size = mysql_harness::kDefaultStackSizeInKiloBytes | ) |
Allocates memory for thread of execution.
thread_stack_size | the memory size allocated to thread's stack |
std::runtime_error | if cannot adjust thread size |
mysql_harness::MySQLRouterThread::~MySQLRouterThread | ( | ) |
Waits for a thread to finish its execution if thread is joinable and join wasn't called.
|
explicitdelete |
void mysql_harness::MySQLRouterThread::join | ( | ) |
Waits for a thread to finish its execution.
|
delete |
void mysql_harness::MySQLRouterThread::run | ( | thread_function | run_thread, |
void * | args_ptr, | ||
bool | detach = false |
||
) |
Execute run_thread function in thread of execution.
run_thread | the pointer to the function that is executed in thread. It has to be non-member void*(void*) function |
args_ptr | pointer to run_thread parameter |
detach | true if thread is detached, false if thread is joinable |
std::runtime_error | if cannot create new thread of execution |
|
private |
true if thread is joinable but join wasn't called, false otherwise
|
private |
attribute of thread
|
private |
handle to the thread