From 497ab60346e74927fb7980734799d1e57af541d5 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Wed, 18 Apr 2012 23:59:05 +0000 Subject: - Correctly call mysql_library_init() on application start, and mysql_thread_init() and mysql_thread_end() on each thread as appropriate. This will improve observed MySQL stability, especially in certain circumstances such as LOAD DATA INFILE. --- .../Source/SPMySQLConnection Categories/Ping & KeepAlive.m | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m') diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m index 3ce0c0cd..3201b55f 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m @@ -187,6 +187,9 @@ void _backgroundPingTask(void *ptr) // Set up a cleanup routine pthread_cleanup_push(_pingThreadCleanup, pingDetails); + // Initialise MySQL variables and handling on this thread + mysql_thread_init(); + // Set up a signal handler for SIGUSR1, to handle forced timeouts. signal(SIGUSR1, _forceThreadExit); @@ -209,6 +212,9 @@ void _pingThreadCleanup(void *pingDetails) { SPMySQLConnectionPingDetails *pingDetailsStruct = pingDetails; *(pingDetailsStruct->keepAlivePingActivePointer) = NO; + + // Clean up MySQL variables and handlers + mysql_thread_end(); } @end -- cgit v1.2.3