1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

cleanup: THD::abort_current_cond_wait()

* reuse the loop in THD::abort_current_cond_wait, don't duplicate it
* find_thread_by_id should return whatever it has found, it's the
  caller's task not to kill COM_DAEMON (if the caller's a killer)

and other minor changes
This commit is contained in:
Sergei Golubchik
2021-02-05 15:00:38 +01:00
parent cbbcc8fa2b
commit 259a1902a0
7 changed files with 34 additions and 87 deletions

View File

@ -2869,23 +2869,7 @@ void kill_delayed_threads(void)
mysql_mutex_lock(&di->thd.LOCK_thd_kill);
if (di->thd.killed < KILL_CONNECTION)
di->thd.set_killed_no_mutex(KILL_CONNECTION);
if (di->thd.mysys_var)
{
mysql_mutex_lock(&di->thd.mysys_var->mutex);
if (di->thd.mysys_var->current_cond)
{
/*
We need the following test because the main mutex may be locked
in handle_delayed_insert()
*/
if (&di->mutex != di->thd.mysys_var->current_mutex)
mysql_mutex_lock(di->thd.mysys_var->current_mutex);
mysql_cond_broadcast(di->thd.mysys_var->current_cond);
if (&di->mutex != di->thd.mysys_var->current_mutex)
mysql_mutex_unlock(di->thd.mysys_var->current_mutex);
}
mysql_mutex_unlock(&di->thd.mysys_var->mutex);
}
di->thd.abort_current_cond_wait(false);
mysql_mutex_unlock(&di->thd.LOCK_thd_kill);
}
mysql_mutex_unlock(&LOCK_delayed_insert); // For unlink from list