[Commits] Rev 3213: close callbacks prior to closing connection to avoid potential race when e.g timer callback and connection_destroy run in parallel in file:///H:/bzr/5.5-threadpool/

Vladislav Vaintroub wlad at montyprogram.com
Fri Jan 27 01:40:03 EET 2012


At file:///H:/bzr/5.5-threadpool/

------------------------------------------------------------
revno: 3213
revision-id: wlad at montyprogram.com-20120126233923-d83s2fr70tuz7ckh
parent: wlad at montyprogram.com-20120126190925-2vngvj0x7mueyt2f
committer: Vladislav Vaintroub <wlad at montyprogram.com>
branch nick: 5.5-threadpool
timestamp: Fri 2012-01-27 00:39:23 +0100
message:
  close callbacks prior to closing connection to avoid potential race when e.g timer callback and connection_destroy run in parallel
-------------- next part --------------
=== modified file 'sql/threadpool_win.cc'
--- a/sql/threadpool_win.cc	2012-01-26 03:35:54 +0000
+++ b/sql/threadpool_win.cc	2012-01-26 23:39:23 +0000
@@ -404,11 +404,6 @@
 /* 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 @@
     WaitForThreadpoolTimerCallbacks(connection->timer, TRUE);
     CloseThreadpoolTimer(connection->timer);
   }
+  
+  if (connection->thd)
+  {
+    threadpool_remove_connection(connection->thd);
+  }
 
   DestroyThreadpoolEnvironment(&connection->callback_environ);
 }



More information about the commits mailing list