diff options
author | Mikael Ronström <mikael@dator9> | 2011-05-18 09:38:05 +0200 |
---|---|---|
committer | Mikael Ronström <mikael@dator9> | 2011-05-18 09:38:05 +0200 |
commit | 215ce05aba7ebe1a52739771afea9b460fc96d98 (patch) | |
tree | 2850e50b0055d2e3e5e56fbfbe8bd9b9ae6cef4f /sql | |
parent | ecb3814be8c293c1757cfa1587b31fdfbfca8ae4 (diff) | |
download | mariadb-git-215ce05aba7ebe1a52739771afea9b460fc96d98.tar.gz |
Split up unlink_thd in several functions
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysqld.cc | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f078c703a1a..2192b0f3ee9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2010,6 +2010,36 @@ extern "C" sig_handler end_thread_signal(int sig __attribute__((unused))) /* + Decrease number of connections + + SYNOPSIS + dec_connection_count() +*/ + +void dec_connection_count() +{ + mysql_mutex_lock(&LOCK_connection_count); + --connection_count; + mysql_mutex_unlock(&LOCK_connection_count); +} + + +/* + Delete the THD object and decrease number of threads + + SYNOPSIS + delete_thd() + thd Thread handler +*/ + +void delete_thd(THD *thd) +{ + thread_count--; + delete thd; +} + + +/* Unlink thd from global list of available connections and free thd SYNOPSIS @@ -2024,15 +2054,10 @@ void unlink_thd(THD *thd) { DBUG_ENTER("unlink_thd"); DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd)); - thd->cleanup(); - - mysql_mutex_lock(&LOCK_connection_count); - --connection_count; - mysql_mutex_unlock(&LOCK_connection_count); + dec_connection_count(); mysql_mutex_lock(&LOCK_thread_count); - thread_count--; - delete thd; + delete_thd(thd); DBUG_VOID_RETURN; } |