summaryrefslogtreecommitdiff
path: root/sql/threadpool_common.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-04-27 17:38:17 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-04-27 17:38:17 +0300
commitb63446984c2c8441c19fc646f6652a9bc3076304 (patch)
treea874d841721ba5d80f66e92e5e16dc0ab4233e2a /sql/threadpool_common.cc
parent6dab094fbd31ef93a1d51b1b9c867188b2f958c3 (diff)
parent3568fad5c935426a275900e8130657b18ba14e9f (diff)
downloadmariadb-git-b63446984c2c8441c19fc646f6652a9bc3076304.tar.gz
Merge 10.3 into 10.4
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 efcc56d67be..3a0c7a8514c 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
@@ -47,7 +47,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)
@@ -86,14 +85,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);
}
};
@@ -144,7 +143,7 @@ static void thread_attach(THD* thd)
attaching the thd. */
wsrep_wait_rollback_complete_and_acquire_ownership(thd);
#endif /* WITH_WSREP */
- 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);
@@ -229,9 +228,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? */