Commit 732adec0 authored by Monty's avatar Monty

Removed some not needed when doing delete thd, which caused warnings about

wrong mutex usage from safe_mutex.
Ensure that LOCK_status is always taken before LOCK_thread_count
parent b4ff6456
......@@ -9597,9 +9597,7 @@ binlog_background_thread(void *arg __attribute__((unused)))
THD_STAGE_INFO(thd, stage_binlog_stopping_background_thread);
mysql_mutex_lock(&LOCK_thread_count);
delete thd;
mysql_mutex_unlock(&LOCK_thread_count);
my_thread_end();
......
......@@ -4630,6 +4630,7 @@ static int init_thread_environment()
mysql_mutex_init(key_LOCK_global_system_variables,
&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
mysql_mutex_record_order(&LOCK_active_mi, &LOCK_global_system_variables);
mysql_mutex_record_order(&LOCK_status, &LOCK_thread_count);
mysql_rwlock_init(key_rwlock_LOCK_system_variables_hash,
&LOCK_system_variables_hash);
mysql_mutex_init(key_LOCK_prepared_stmt_count,
......
......@@ -1372,10 +1372,11 @@ handle_rpl_parallel_thread(void *arg)
thd->reset_db(NULL, 0);
thd_proc_info(thd, "Slave worker thread exiting");
thd->temporary_tables= 0;
mysql_mutex_lock(&LOCK_thread_count);
THD_CHECK_SENTRY(thd);
delete thd;
thd->unlink();
mysql_mutex_unlock(&LOCK_thread_count);
delete thd;
mysql_mutex_lock(&rpt->LOCK_rpl_thread);
rpt->running= false;
......
......@@ -311,9 +311,7 @@ handle_slave_init(void *arg __attribute__((unused)))
thd->get_stmt_da()->sql_errno(),
thd->get_stmt_da()->message());
mysql_mutex_lock(&LOCK_thread_count);
delete thd;
mysql_mutex_unlock(&LOCK_thread_count);
thread_safe_decrement32(&service_thread_count);
signal_thd_deleted();
my_thread_end();
......@@ -4961,8 +4959,9 @@ err_during_init:
mysql_mutex_unlock(&LOCK_active_mi);
mysql_mutex_lock(&LOCK_thread_count);
delete thd;
thd->unlink();
mysql_mutex_unlock(&LOCK_thread_count);
delete thd;
thread_safe_decrement32(&service_thread_count);
signal_thd_deleted();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment