summaryrefslogtreecommitdiff
path: root/sql/threadpool_win.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2012-03-28 01:11:05 +0200
committerVladislav Vaintroub <wlad@montyprogram.com>2012-03-28 01:11:05 +0200
commitec032ae54bb260eda4e654c1f04d5589a4de0a04 (patch)
tree0780f5974bf18577d41328e9b569c50819e5cf34 /sql/threadpool_win.cc
parent903ad7c94137f7c844cde03befc4ddd8e9713a3b (diff)
downloadmariadb-git-ec032ae54bb260eda4e654c1f04d5589a4de0a04.tar.gz
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.
Diffstat (limited to 'sql/threadpool_win.cc')
-rw-r--r--sql/threadpool_win.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/threadpool_win.cc b/sql/threadpool_win.cc
index bf1d4740a13..346f2816e39 100644
--- a/sql/threadpool_win.cc
+++ b/sql/threadpool_win.cc
@@ -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);
}
}