summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2020-04-30 20:06:26 +0300
committerEugene Kosov <claprix@yandex.ru>2020-05-05 18:13:31 +0300
commit89ff4176c125f5993aba0732e52102227577ed96 (patch)
tree42980e30d3f4f02b09b0fda80790f7241fd699f4 /libmysqld
parent90aad47dd9f28101b1d2c4a01c2a10db5ad5f426 (diff)
downloadmariadb-git-89ff4176c125f5993aba0732e52102227577ed96.tar.gz
MDEV-22437 make THR_THD* variable thread_local
Now all access goes through _current_thd() and set_current_thd() functions. Some functions like THD::store_globals() can not fail now.
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/lib_sql.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index d5810f5e48e..b93cd85bfe8 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -437,7 +437,7 @@ static void emb_free_embedded_thd(MYSQL *mysql)
thd->clear_data_list();
thd->store_globals();
delete thd;
- my_pthread_setspecific_ptr(THR_THD, 0);
+ set_current_thd(nullptr);
mysql->thd=0;
}
@@ -683,11 +683,7 @@ void *create_embedded_thd(int client_flag)
THD * thd= new THD(next_thread_id());
thd->thread_stack= (char*) &thd;
- if (thd->store_globals())
- {
- fprintf(stderr,"store_globals failed.\n");
- goto err;
- }
+ thd->store_globals();
lex_start(thd);
/* TODO - add init_connect command execution */
@@ -714,9 +710,6 @@ void *create_embedded_thd(int client_flag)
thd->mysys_var= 0;
thd->reset_globals();
return thd;
-err:
- delete(thd);
- return NULL;
}