aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/SPMySQLFramework/Source
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-10-26 00:32:31 +0100
committerMax <post@wickenrode.com>2015-10-26 00:32:31 +0100
commit2b2a177e7adceabadd451c0dca300b30f14aebb2 (patch)
treefa6452f5191e14fbc8a250cb1821e4c0b292b497 /Frameworks/SPMySQLFramework/Source
parent2ed7473afe7bcc9ab7243f3347a5112d917b7385 (diff)
downloadsequelpro-2b2a177e7adceabadd451c0dca300b30f14aebb2.tar.gz
sequelpro-2b2a177e7adceabadd451c0dca300b30f14aebb2.tar.bz2
sequelpro-2b2a177e7adceabadd451c0dca300b30f14aebb2.zip
* Remove some ivars that are only used as local vars
* Also I take back what I said about 4d97cbd4df1ebb451d89d6c4e12dd7c622d00b84 and say it will happen now *duckundweg*
Diffstat (limited to 'Frameworks/SPMySQLFramework/Source')
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.h4
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m10
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection.h4
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m2
4 files changed, 9 insertions, 11 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.h b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.h
index ae3c8156..a3f34817 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.h
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.h
@@ -32,8 +32,8 @@
typedef struct {
MYSQL *mySQLConnection;
- BOOL *keepAlivePingActivePointer;
- BOOL *keepAliveLastPingSuccessPointer;
+ volatile BOOL *keepAlivePingThreadActivePointer;
+ volatile BOOL *keepAliveLastPingSuccessPointer;
} SPMySQLConnectionPingDetails;
@interface SPMySQLConnection (Ping_and_KeepAlive)
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
index c4469f5c..cfbb7183 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
@@ -140,7 +140,7 @@ end:
// Set up a query lock
[self _lockConnection];
- keepAliveLastPingSuccess = NO;
+ volatile BOOL keepAliveLastPingSuccess = NO;
keepAliveLastPingBlocked = NO;
keepAlivePingThreadActive = YES;
@@ -152,12 +152,14 @@ end:
SPMySQLConnectionPingDetails *pingDetails = malloc(sizeof(SPMySQLConnectionPingDetails));
pingDetails->mySQLConnection = mySQLConnection;
pingDetails->keepAliveLastPingSuccessPointer = &keepAliveLastPingSuccess;
- pingDetails->keepAlivePingActivePointer = &keepAlivePingThreadActive;
+ pingDetails->keepAlivePingThreadActivePointer = &keepAlivePingThreadActive;
// Create a pthread for the ping
+ pthread_t keepAlivePingThread_t;
+
pthread_attr_t attr;
pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
pthread_create(&keepAlivePingThread_t, &attr, (void *)&_backgroundPingTask, pingDetails);
// Record the ping start time
@@ -245,7 +247,7 @@ void _forceThreadExit(int signalNumber)
void _pingThreadCleanup(void *pingDetails)
{
SPMySQLConnectionPingDetails *pingDetailsStruct = pingDetails;
- *(pingDetailsStruct->keepAlivePingActivePointer) = NO;
+ *(pingDetailsStruct->keepAlivePingThreadActivePointer) = NO;
// Clean up MySQL variables and handlers
mysql_thread_end();
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.h b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.h
index 9fae3f98..444e8dff 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.h
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.h
@@ -86,9 +86,7 @@
uint64_t lastKeepAliveTime;
NSUInteger keepAlivePingFailures;
volatile NSThread *keepAliveThread;
- pthread_t keepAlivePingThread_t;
- BOOL keepAlivePingThreadActive;
- BOOL keepAliveLastPingSuccess;
+ volatile BOOL keepAlivePingThreadActive;
BOOL keepAliveLastPingBlocked;
// Encoding details - and also a record of any previous encoding to allow
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
index bcb4e031..eb1816b5 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
@@ -145,9 +145,7 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS
keepAlivePingFailures = 0;
lastKeepAliveTime = 0;
keepAliveThread = nil;
- keepAlivePingThread_t = NULL;
keepAlivePingThreadActive = NO;
- keepAliveLastPingSuccess = NO;
keepAliveLastPingBlocked = NO;
// Set up default encoding variables