summaryrefslogtreecommitdiff
path: root/sql/threadpool_common.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-12-29 19:37:11 +0400
committerAlexander Barkov <bar@mariadb.org>2015-12-29 19:37:11 +0400
commit2ba7ed77aab05004f0c853a77850e325b78a1892 (patch)
tree943659d76215e16d0d1946c28683c562debeff34 /sql/threadpool_common.cc
parent63f0669fd6dc430b60ffd5de0bff9854622a1c1a (diff)
parent1bb66ea88c4679d6bd3ad1472d75983e66f679ae (diff)
downloadmariadb-git-2ba7ed77aab05004f0c853a77850e325b78a1892.tar.gz
Merge remote-tracking branch 'origin/10.1' into 10.2
Diffstat (limited to 'sql/threadpool_common.cc')
-rw-r--r--sql/threadpool_common.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 97352e401d4..9fb38319096 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -167,22 +167,28 @@ int threadpool_add_connection(THD *thd)
return retval;
}
+/*
+ threadpool_cleanup_connection() does the bulk of connection shutdown work.
+ Usually called from threadpool_remove_connection(), but rarely it might
+ be called also in the main polling thread if connection initialization fails.
+*/
+void threadpool_cleanup_connection(THD *thd)
+{
+ thd->net.reading_or_writing = 0;
+ end_connection(thd);
+ close_connection(thd, 0);
+ unlink_thd(thd);
+ mysql_cond_broadcast(&COND_thread_count);
+}
+
void threadpool_remove_connection(THD *thd)
{
-
Worker_thread_context worker_context;
worker_context.save();
-
thread_attach(thd);
- thd->net.reading_or_writing= 0;
-
- end_connection(thd);
- close_connection(thd, 0);
-
- unlink_thd(thd);
- mysql_cond_broadcast(&COND_thread_count);
+ threadpool_cleanup_connection(thd);
/*
Free resources associated with this connection:
mysys thread_var and PSI thread.