diff options
-rw-r--r-- | sql/mysqld.cc | 3 | ||||
-rw-r--r-- | sql/scheduler.cc | 1 | ||||
-rw-r--r-- | sql/threadpool_common.cc | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 835074d6e5f..ad1c301a234 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2972,7 +2972,6 @@ void unlink_thd(THD *thd) unlink_not_visible_thd(thd); thd->free_connection(); - dec_thread_count(); DBUG_VOID_RETURN; } @@ -3117,6 +3116,7 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache) if (!wsrep_applier && put_in_cache && cache_thread(thd)) DBUG_RETURN(0); // Thread is reused delete thd; + dec_thread_count(); } DBUG_PRINT("info", ("killing thread")); @@ -6418,6 +6418,7 @@ void create_thread_to_handle_connection(CONNECT *connect) /* Get thread from cache */ thread_cache.push_back(connect); wake_thread++; + thread_safe_decrement32(&thread_count); mysql_cond_signal(&COND_thread_cache); mysql_mutex_unlock(&LOCK_thread_cache); DBUG_PRINT("info",("Thread created")); diff --git a/sql/scheduler.cc b/sql/scheduler.cc index de472ae2504..95702dbb4e1 100644 --- a/sql/scheduler.cc +++ b/sql/scheduler.cc @@ -39,6 +39,7 @@ static bool no_threads_end(THD *thd, bool put_in_cache) { unlink_thd(thd); delete thd; + dec_thread_count(); } return 1; // Abort handle_one_connection } diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 520a16c467e..9de168c9fdf 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -201,7 +201,7 @@ void threadpool_remove_connection(THD *thd) close_connection(thd, 0); unlink_thd(thd); delete thd; - mysql_cond_broadcast(&COND_thread_count); + dec_thread_count(); /* Free resources associated with this connection: |