24#ifndef MYSQL_THREAD_INCLUDE
25#define MYSQL_THREAD_INCLUDE
53 void *
operator new(
size_t size,
const std::nothrow_t &)
noexcept {
70 void operator delete(
void *ptr,
const std::nothrow_t &)
noexcept {
83 void *
operator new(
size_t size)
noexcept {
97 void operator delete(
void *ptr)
noexcept {
my_free(ptr); }
128 void *
operator new(
size_t size,
const std::nothrow_t &)
noexcept {
145 void operator delete(
void *ptr,
const std::nothrow_t &)
noexcept {
158 void *
operator new(
size_t size)
noexcept {
172 void operator delete(
void *ptr)
noexcept {
my_free(ptr); }
Abortable synchronized queue extends synchronized queue allowing to abort methods waiting for element...
Definition: plugin_utils.h:272
Interface for Mysql_thread_body parameters.
Definition: mysql_thread.h:39
Mysql_thread_body_parameters()
Definition: mysql_thread.h:99
virtual ~Mysql_thread_body_parameters()
Definition: mysql_thread.h:100
Interface for Mysql_thread_body, the task of a Mysql_thread.
Definition: mysql_thread.h:108
virtual ~Mysql_thread_body()
Definition: mysql_thread.h:110
virtual void run(Mysql_thread_body_parameters *parameters)=0
Definition: mysql_thread.h:114
Mysql_thread_body_parameters * m_parameters
Definition: mysql_thread.h:199
Mysql_thread_body * m_body
Definition: mysql_thread.h:198
void execute()
Execute task, calling body function with parameters.
Definition: mysql_thread.cc:37
virtual ~Mysql_thread_task()
Definition: mysql_thread.h:177
Mysql_thread_task(Mysql_thread_body *body, Mysql_thread_body_parameters *parameters)
Definition: mysql_thread.h:174
bool is_finished()
Check if the task did finish.
Definition: mysql_thread.cc:42
std::atomic< bool > m_finished
Definition: mysql_thread.h:200
A generic single thread executor.
Definition: mysql_thread.h:208
my_thread_handle m_pthd
Definition: mysql_thread.h:260
mysql_cond_t m_run_cond
Definition: mysql_thread.h:262
std::atomic< bool > m_aborted
Definition: mysql_thread.h:264
PSI_mutex_key m_mutex_key
Definition: mysql_thread.h:254
PSI_thread_key m_thread_key
Definition: mysql_thread.h:253
mysql_mutex_t m_run_lock
Definition: mysql_thread.h:261
bool terminate()
Terminate the thread.
Definition: mysql_thread.cc:129
PSI_cond_key m_cond_key
Definition: mysql_thread.h:255
thread_state m_state
Definition: mysql_thread.h:263
bool trigger(Mysql_thread_task *task)
Trigger a task to run synchronously.
Definition: mysql_thread.cc:250
virtual ~Mysql_thread()
Definition: mysql_thread.cc:65
mysql_cond_t m_dispatcher_cond
Definition: mysql_thread.h:267
mysql_mutex_t m_dispatcher_lock
Definition: mysql_thread.h:266
Mysql_thread(PSI_thread_key thread_key, PSI_mutex_key run_mutex_key, PSI_cond_key run_cond_key, PSI_mutex_key dispatcher_mutex_key, PSI_cond_key dispatcher_cond_key)
Mysql_thread constructor.
Definition: mysql_thread.cc:44
bool initialize()
Initialize the thread.
Definition: mysql_thread.cc:82
PSI_mutex_key m_dispatcher_mutex_key
Definition: mysql_thread.h:256
PSI_cond_key m_dispatcher_cond_key
Definition: mysql_thread.h:257
Abortable_synchronized_queue< Mysql_thread_task * > * m_trigger_queue
Definition: mysql_thread.h:269
void dispatcher()
Thread worker method.
Definition: mysql_thread.cc:161
THD * m_thd
Definition: mysql_thread.h:259
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
#define MY_WME
Definition: my_sys.h:130
unsigned int PSI_cond_key
Instrumented cond key.
Definition: psi_cond_bits.h:44
unsigned int PSI_mutex_key
Instrumented mutex key.
Definition: psi_mutex_bits.h:52
unsigned int PSI_thread_key
Instrumented thread key.
Definition: psi_thread_bits.h:50
#define MYF(v)
Definition: my_inttypes.h:97
void * my_malloc(PSI_memory_key key, size_t size, int flags)
Allocates size bytes of memory.
Definition: my_memory.cc:57
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
size_t size(const char *const c)
Definition: base64.h:46
PSI_memory_key key_mysql_thread_queued_task
Definition: plugin_psi.h:242
Definition: my_thread_bits.h:58
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
Definition: plugin_utils.h:48