1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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.
This commit is contained in:
Eugene Kosov
2020-04-30 20:06:26 +03:00
parent 90aad47dd9
commit 89ff4176c1
23 changed files with 56 additions and 121 deletions

View File

@@ -302,7 +302,7 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag)
thd->db.length= sizeof("handlersocket")-1;
}
thd->variables.option_bits |= OPTION_TABLE_LOCK;
my_pthread_setspecific_ptr(THR_THD, thd);
set_current_thd(thd);
DBG_THR(fprintf(stderr, "HNDSOCK x0 %p\n", thd));
}
{
@@ -339,7 +339,7 @@ dbcontext::term_thread()
{
DBG_THR(fprintf(stderr, "HNDSOCK thread end %p\n", thd));
close_tables_if();
my_pthread_setspecific_ptr(THR_THD, 0);
set_current_thd(nullptr);
{
delete thd;
thd = 0;