summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc39
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;
}