diff options
Diffstat (limited to 'sql/threadpool_common.cc')
-rw-r--r-- | sql/threadpool_common.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 4dd0fa35b40..b741858fcb2 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -45,7 +45,6 @@ static void threadpool_remove_connection(THD *thd); static int threadpool_process_request(THD *thd); static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data); -extern "C" pthread_key(struct st_my_thread_var*, THR_KEY_mysys); extern bool do_command(THD*); static inline TP_connection *get_TP_connection(THD *thd) @@ -85,13 +84,13 @@ struct Worker_thread_context void save() { psi_thread = PSI_CALL_get_thread(); - mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys); + mysys_var= my_thread_var; } void restore() { PSI_CALL_set_thread(psi_thread); - pthread_setspecific(THR_KEY_mysys,mysys_var); + set_mysys_var(mysys_var); pthread_setspecific(THR_THD, 0); } }; @@ -137,7 +136,7 @@ static inline void set_thd_idle(THD *thd) */ static void thread_attach(THD* thd) { - pthread_setspecific(THR_KEY_mysys,thd->mysys_var); + set_mysys_var(thd->mysys_var); thd->thread_stack=(char*)&thd; thd->store_globals(); PSI_CALL_set_thread(thd->event_scheduler.m_psi); @@ -222,9 +221,9 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data) Store them in THD. */ - pthread_setspecific(THR_KEY_mysys, 0); + set_mysys_var(nullptr); my_thread_init(); - st_my_thread_var* mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys); + st_my_thread_var* mysys_var= my_thread_var; if (!mysys_var ||!(thd= connect->create_thd(NULL))) { /* Out of memory? */ |