summaryrefslogtreecommitdiff
path: root/sql/threadpool_win.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2012-01-27 00:39:23 +0100
committerVladislav Vaintroub <wlad@montyprogram.com>2012-01-27 00:39:23 +0100
commit8b945a14193825f98b6591ae34e5a6681f5ba04c (patch)
tree988f2b82e3d418abec40ced38b69ccf7bf6eaadb /sql/threadpool_win.cc
parent0e2197c7f79b25d5777032b83c565597362eb3f2 (diff)
downloadmariadb-git-8b945a14193825f98b6591ae34e5a6681f5ba04c.tar.gz
close callbacks prior to closing connection to avoid potential race when e.g timer callback and connection_destroy run in parallel
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 ae186a614ee..b4c73e6be63 100644
--- a/sql/threadpool_win.cc
+++ b/sql/threadpool_win.cc
@@ -404,11 +404,6 @@ void set_wait_timeout(connection_t *connection, ulonglong old_timeout)
/* Connection destructor */
void destroy_connection(connection_t *connection)
{
- if (connection->thd)
- {
- threadpool_remove_connection(connection->thd);
- }
-
if (connection->io)
{
WaitForThreadpoolIoCallbacks(connection->io, TRUE);
@@ -427,6 +422,11 @@ void destroy_connection(connection_t *connection)
WaitForThreadpoolTimerCallbacks(connection->timer, TRUE);
CloseThreadpoolTimer(connection->timer);
}
+
+ if (connection->thd)
+ {
+ threadpool_remove_connection(connection->thd);
+ }
DestroyThreadpoolEnvironment(&connection->callback_environ);
}