diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-05-14 13:22:47 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-06-04 09:06:00 +0200 |
commit | 562c1df7d97cb23145e09b3482fd18d49476752d (patch) | |
tree | 0d8e3d45c78dafd5854e8c6d6488b232f3f631a7 /plugin | |
parent | 7425610c81ca1329d72a97f57770e5b052d08079 (diff) | |
download | mariadb-git-562c1df7d97cb23145e09b3482fd18d49476752d.tar.gz |
cleanup: thread_count
move thread_count handling into THD:
* increment thread_count in THD constructor
* decrement thread_count in THD destructor
* never modify thread_count directly!
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/feedback/sender_thread.cc | 2 | ||||
-rw-r--r-- | plugin/handler_socket/handlersocket/database.cpp | 2 |
2 files changed, 0 insertions, 4 deletions
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc index 1b90d2cb340..16cdfe5574a 100644 --- a/plugin/feedback/sender_thread.cc +++ b/plugin/feedback/sender_thread.cc @@ -91,7 +91,6 @@ static int prepare_for_fill(TABLE_LIST *tables) */ thd->variables.pseudo_thread_id= thd->thread_id; mysql_mutex_lock(&LOCK_thread_count); - thread_count++; threads.append(thd); mysql_mutex_unlock(&LOCK_thread_count); thd->thread_stack= (char*) &tables; @@ -263,7 +262,6 @@ ret: */ mysql_mutex_lock(&LOCK_thread_count); thd->set_status_var_init(); - thread_count--; thd->killed= KILL_CONNECTION; thd->unlink(); mysql_cond_broadcast(&COND_thread_count); diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp index 28ce6c78876..4292b826753 100644 --- a/plugin/handler_socket/handlersocket/database.cpp +++ b/plugin/handler_socket/handlersocket/database.cpp @@ -310,7 +310,6 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag) } { thd->thread_id = next_thread_id(); - thread_safe_increment32(&thread_count); add_to_active_threads(thd); } @@ -348,7 +347,6 @@ dbcontext::term_thread() pthread_mutex_lock(&LOCK_thread_count); delete thd; thd = 0; - --thread_count; pthread_mutex_unlock(&LOCK_thread_count); my_thread_end(); } |