mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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!
This commit is contained in:
@ -1403,14 +1403,7 @@ void CONNECT::close_and_delete()
|
||||
if (vio)
|
||||
vio_close(vio);
|
||||
if (thread_count_incremented)
|
||||
{
|
||||
/*
|
||||
Normally this is handled by THD::unlink. As we haven't yet created
|
||||
a THD and put it in the thread list, we have to manage counting here.
|
||||
*/
|
||||
dec_thread_count();
|
||||
dec_connection_count(scheduler);
|
||||
}
|
||||
statistic_increment(connection_errors_internal, &LOCK_status);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
|
||||
@ -1434,23 +1427,8 @@ void CONNECT::close_with_error(uint sql_errno,
|
||||
close_connection(thd, close_error);
|
||||
delete thd;
|
||||
set_current_thd(0);
|
||||
if (thread_count_incremented)
|
||||
{
|
||||
dec_thread_count();
|
||||
dec_connection_count(scheduler);
|
||||
}
|
||||
delete this;
|
||||
statistic_increment(connection_errors_internal, &LOCK_status);
|
||||
statistic_increment(aborted_connects,&LOCK_status);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
Out of memory; We can't generate an error, just close the connection
|
||||
close_and_delete() will increment statistics.
|
||||
*/
|
||||
close_and_delete();
|
||||
}
|
||||
close_and_delete();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user