summaryrefslogtreecommitdiff
path: root/sql/threadpool_common.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-04-27 14:24:41 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-04-27 14:24:41 +0300
commit2e12d471eab9db77473ec80637f8d0d2d03bf69f (patch)
treeeea2f8df98e8ccbd28d59b75706f44330fd4407d /sql/threadpool_common.cc
parent61c0df94655f2dc3146456e49f3f51610251e79f (diff)
parentc06845d6f04e092b64c105eb6786056cea2ab593 (diff)
downloadmariadb-git-2e12d471eab9db77473ec80637f8d0d2d03bf69f.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/threadpool_common.cc')
-rw-r--r--sql/threadpool_common.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 157a76a5150..53e22cd04ed 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012 Monty Program Ab
+/* Copyright (C) 2012, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -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)
@@ -84,14 +83,14 @@ struct Worker_thread_context
void save()
{
- psi_thread = PSI_CALL_get_thread();
- mysys_var= (st_my_thread_var *)pthread_getspecific(THR_KEY_mysys);
+ psi_thread= PSI_CALL_get_thread();
+ 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(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? */