|
|
@ -2906,7 +2906,6 @@ void delete_running_thd(THD *thd) |
|
|
|
|
|
|
|
delete thd; |
|
|
|
dec_thread_running(); |
|
|
|
dec_thread_count(); |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
@ -2916,14 +2915,6 @@ void delete_running_thd(THD *thd) |
|
|
|
dec_thread_count() |
|
|
|
*/ |
|
|
|
|
|
|
|
void dec_thread_count(void) |
|
|
|
{ |
|
|
|
DBUG_ASSERT(thread_count > 0); |
|
|
|
thread_safe_decrement32(&thread_count); |
|
|
|
signal_thd_deleted(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Send a signal to unblock close_conneciton() / rpl_slave_init_thread() |
|
|
|
if there is no more threads running with a THD attached |
|
|
@ -3116,7 +3107,6 @@ 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")); |
|
|
@ -6329,7 +6319,6 @@ static void bootstrap(MYSQL_FILE *file) |
|
|
|
my_net_init(&thd->net,(st_vio*) 0, (void*) 0, MYF(0)); |
|
|
|
thd->max_client_packet_length= thd->net.max_packet; |
|
|
|
thd->security_ctx->master_access= ~(ulong)0; |
|
|
|
thread_count++; // Safe as only one thread running
|
|
|
|
in_bootstrap= TRUE; |
|
|
|
|
|
|
|
bootstrap_file=file; |
|
|
@ -6418,7 +6407,6 @@ 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")); |
|
|
@ -6434,23 +6422,15 @@ void create_thread_to_handle_connection(CONNECT *connect) |
|
|
|
|
|
|
|
if ((error= mysql_thread_create(key_thread_one_connection, |
|
|
|
&connect->real_id, &connection_attrib, |
|
|
|
handle_one_connection, |
|
|
|
(void*) connect))) |
|
|
|
handle_one_connection, (void*) connect))) |
|
|
|
{ |
|
|
|
/* purecov: begin inspected */ |
|
|
|
DBUG_PRINT("error", |
|
|
|
("Can't create thread to handle request (error %d)", |
|
|
|
DBUG_PRINT("error", ("Can't create thread to handle request (error %d)", |
|
|
|
error)); |
|
|
|
dec_connection_count(connect->scheduler); |
|
|
|
statistic_increment(aborted_connects,&LOCK_status); |
|
|
|
statistic_increment(connection_errors_internal, &LOCK_status); |
|
|
|
my_snprintf(error_message_buff, sizeof(error_message_buff), |
|
|
|
ER_DEFAULT(ER_CANT_CREATE_THREAD), error); |
|
|
|
connect->close_with_error(ER_CANT_CREATE_THREAD, |
|
|
|
error_message_buff, |
|
|
|
connect->close_with_error(ER_CANT_CREATE_THREAD, error_message_buff, |
|
|
|
ER_OUT_OF_RESOURCES); |
|
|
|
/* thread_count was incremented in create_new_thread() */ |
|
|
|
dec_thread_count(); |
|
|
|
DBUG_VOID_RETURN; |
|
|
|
/* purecov: end */ |
|
|
|
} |
|
|
@ -6502,7 +6482,6 @@ static void create_new_thread(CONNECT *connect) |
|
|
|
|
|
|
|
mysql_mutex_unlock(&LOCK_connection_count); |
|
|
|
|
|
|
|
thread_safe_increment32(&thread_count); |
|
|
|
connect->thread_count_incremented= 1; |
|
|
|
|
|
|
|
/*
|
|
|
|