MySQL 26.7.0
Source Code Documentation
mysql::concurrency::Thread Class Reference

Wrapper to mysql thread, which matches interface of std::thread. More...

#include <thread_srv.h>

Public Member Functions

 Thread ()=default
 
 Thread (const Thread &)=delete
 
Threadoperator= (const Thread &src)=delete
 
 Thread (Thread &&)=default
 
Threadoperator= (Thread &&)=default
 
template<class Callable , class... Args>
 Thread (Thread_key thread_key, Callable &&run_func, Args &&...args)
 Creates a thread, runs thread function. More...
 
template<class Callable , class... Args>
 Thread (Callable &&run_func, Args &&...args)
 Creates a thread, runs thread function. More...
 
void join ()
 Joins thread. More...
 
bool joinable () const
 Checks whether a thread was created successfully. More...
 
int creation_error_code () const
 Returns the thread creation error code. More...
 

Private Attributes

my_thread_handle m_thread_handle
 Mysql thread handle. More...
 
my_thread_attr_t m_thread_attr
 Thread attributes. More...
 
Thread_key m_thread_key {0}
 Thread key. More...
 
int m_creation_error_code {0}
 Thread creation error code. More...
 

Detailed Description

Wrapper to mysql thread, which matches interface of std::thread.

Constructor & Destructor Documentation

◆ Thread() [1/5]

mysql::concurrency::Thread::Thread ( )
default

◆ Thread() [2/5]

mysql::concurrency::Thread::Thread ( const Thread )
delete

◆ Thread() [3/5]

mysql::concurrency::Thread::Thread ( Thread &&  )
default

◆ Thread() [4/5]

template<class Callable , class... Args>
mysql::concurrency::Thread::Thread ( Thread_key  thread_key,
Callable &&  run_func,
Args &&...  args 
)

Creates a thread, runs thread function.

Parameters
thread_keyPSI thread key
run_funcFunction called asynchronously in a separate thread
argsFunction arguments

◆ Thread() [5/5]

template<class Callable , class... Args>
mysql::concurrency::Thread::Thread ( Callable &&  run_func,
Args &&...  args 
)

Creates a thread, runs thread function.

Parameters
run_funcFunction called asynchronously in a separate thread
argsFunction arguments

Member Function Documentation

◆ creation_error_code()

int mysql::concurrency::Thread::creation_error_code ( ) const
inline

Returns the thread creation error code.

Returns
0 on success, error code on failure.

◆ join()

void mysql::concurrency::Thread::join ( )
inline

Joins thread.

◆ joinable()

bool mysql::concurrency::Thread::joinable ( ) const
inline

Checks whether a thread was created successfully.

Returns
True if thread can be joined, false otherwise.

◆ operator=() [1/2]

Thread & mysql::concurrency::Thread::operator= ( const Thread src)
delete

◆ operator=() [2/2]

Thread & mysql::concurrency::Thread::operator= ( Thread &&  )
default

Member Data Documentation

◆ m_creation_error_code

int mysql::concurrency::Thread::m_creation_error_code {0}
private

Thread creation error code.

◆ m_thread_attr

my_thread_attr_t mysql::concurrency::Thread::m_thread_attr
private

Thread attributes.

◆ m_thread_handle

my_thread_handle mysql::concurrency::Thread::m_thread_handle
private

Mysql thread handle.

◆ m_thread_key

Thread_key mysql::concurrency::Thread::m_thread_key {0}
private

Thread key.


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