1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Windows threadpool - always disassociate current thread from callback when destroying connection

prior to closing callbacks and calling DestroyThreadpoolEnvironment,  to make sure callbacks 
do not wait for themselves to finish.
This commit is contained in:
Vladislav Vaintroub
2012-03-28 01:11:05 +02:00
parent 903ad7c941
commit ec032ae54b

View File

@ -419,8 +419,10 @@ void set_wait_timeout(connection_t *connection, ulonglong old_timeout)
/* Connection destructor */
void destroy_connection(connection_t *connection)
void destroy_connection(connection_t *connection, PTP_CALLBACK_INSTANCE instance)
{
if (instance)
DisassociateCurrentThreadFromCallback(instance);
if (connection->io)
{
WaitForThreadpoolIoCallbacks(connection->io, TRUE);
@ -583,10 +585,8 @@ static VOID CALLBACK io_completion_callback(PTP_CALLBACK_INSTANCE instance,
error:
/* Some error has occured. */
if (instance)
DisassociateCurrentThreadFromCallback(instance);
destroy_connection(connection);
destroy_connection(connection, instance);
free(connection);
}
@ -603,7 +603,7 @@ static void CALLBACK login_callback(PTP_CALLBACK_INSTANCE instance,
connection_t *connection =(connection_t *)context;
if (login(connection, instance) != 0)
{
destroy_connection(connection);
destroy_connection(connection, instance);
free(connection);
}
}