aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2017-03-09 01:14:55 +0100
committerMax <post@wickenrode.com>2017-03-09 01:14:55 +0100
commit6c3ab14a0cb89e64256c1d3e7db57adb3d45057c (patch)
tree92a73c9a0f9797ddfe16269fceb6fe9e27ede3dd /Frameworks
parentdd2e34f4a3161e6b747982850a7a62dad4babd9c (diff)
downloadsequelpro-6c3ab14a0cb89e64256c1d3e7db57adb3d45057c.tar.gz
sequelpro-6c3ab14a0cb89e64256c1d3e7db57adb3d45057c.tar.bz2
sequelpro-6c3ab14a0cb89e64256c1d3e7db57adb3d45057c.zip
Add a bit of debug info in Connection pinging
Diffstat (limited to 'Frameworks')
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.h1
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m10
2 files changed, 8 insertions, 3 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.h b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.h
index a3f34817..1bd9f85b 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.h
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.h
@@ -34,6 +34,7 @@ typedef struct {
MYSQL *mySQLConnection;
volatile BOOL *keepAlivePingThreadActivePointer;
volatile BOOL *keepAliveLastPingSuccessPointer;
+ void *parentId;
} 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 7940b483..374d0909 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
@@ -33,6 +33,7 @@
#import "SPMySQL Private APIs.h"
#import "Locking.h"
#import <pthread.h>
+#include <stdio.h>
@implementation SPMySQLConnection (Ping_and_KeepAlive)
@@ -85,7 +86,7 @@
}
keepAliveThread = [NSThread currentThread];
- [keepAliveThread setName:@"SPMySQL connection keepalive monitor thread"];
+ [keepAliveThread setName:[NSString stringWithFormat:@"SPMySQL connection keepalive monitor thread (id=%p)", self]];
// If the maximum number of ping failures has been reached, determine whether to reconnect.
if (keepAliveLastPingBlocked || keepAlivePingFailures >= 3) {
@@ -158,6 +159,7 @@ end_cleanup:
pingDetails->mySQLConnection = mySQLConnection;
pingDetails->keepAliveLastPingSuccessPointer = &keepAliveLastPingSuccess;
pingDetails->keepAlivePingThreadActivePointer = &keepAlivePingThreadActive;
+ pingDetails->parentId = self;
// Create a pthread for the ping
pthread_t keepAlivePingThread_t;
@@ -216,9 +218,11 @@ end_cleanup:
*/
void _backgroundPingTask(void *ptr)
{
- pthread_setname_np("SPMySQL _backgroundPingTask() worker thread");
-
SPMySQLConnectionPingDetails *pingDetails = (SPMySQLConnectionPingDetails *)ptr;
+
+ char threadNameBuf[80];
+ snprintf(threadNameBuf, sizeof(threadNameBuf), "SPMySQL _backgroundPingTask() worker thread (id=%p)", pingDetails->parentId);
+ pthread_setname_np(threadNameBuf);
// Set up a cleanup routine
pthread_cleanup_push(_pingThreadCleanup, pingDetails);