diff options
author | Eugene Kosov <claprix@yandex.ru> | 2020-04-07 13:14:41 +0300 |
---|---|---|
committer | Eugene Kosov <claprix@yandex.ru> | 2020-04-25 00:55:39 +0300 |
commit | 2c5067b6890974d0df335a833ed7a4e4c6ced183 (patch) | |
tree | 188a6cebe45fae4e2a4ddc701e400c9247519f5c /sql/threadpool_common.cc | |
parent | da7564edcf239fe7bc612efed97cc7b6fa89320b (diff) | |
download | mariadb-git-2c5067b6890974d0df335a833ed7a4e4c6ced183.tar.gz |
cleanup THR_KEY_mysys
read TLS with my_thread_var
write TLS with set_mysys_var()
my_thread_var is no longer __attribute__ ((const)): this attribute
is simply incorrect here. Read gcc manual for more information.
sql/threadpool_generic.cc fails with that attribute.
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 0a374147e07..b0438770aae 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) @@ -87,7 +86,7 @@ struct Worker_thread_context #ifdef HAVE_PSI_THREAD_INTERFACE psi_thread = PSI_THREAD_CALL(get_thread)(); #endif - mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys); + mysys_var= my_thread_var; } void restore() @@ -95,7 +94,7 @@ struct Worker_thread_context #ifdef HAVE_PSI_THREAD_INTERFACE PSI_THREAD_CALL(set_thread)(psi_thread); #endif - pthread_setspecific(THR_KEY_mysys,mysys_var); + set_mysys_var(mysys_var); pthread_setspecific(THR_THD, 0); } }; @@ -141,7 +140,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(); #ifdef HAVE_PSI_THREAD_INTERFACE @@ -228,9 +227,9 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data) Store them in THD. */ - pthread_setspecific(THR_KEY_mysys, 0); + set_mysys_var(NULL); 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? */ |