diff options
author | Max <post@wickenrode.com> | 2015-07-02 23:46:51 +0200 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-07-02 23:46:51 +0200 |
commit | c124db7ac403cdd92cc2c26e572f37f7b7d4ae75 (patch) | |
tree | 401d9839f330ad88e57dba86ae8f0c7230d5c6d8 /Source/SPDatabaseDocument.m | |
parent | 3c49b0f2bc16777f83cf57825448b6689ed344e1 (diff) | |
download | sequelpro-c124db7ac403cdd92cc2c26e572f37f7b7d4ae75.tar.gz sequelpro-c124db7ac403cdd92cc2c26e572f37f7b7d4ae75.tar.bz2 sequelpro-c124db7ac403cdd92cc2c26e572f37f7b7d4ae75.zip |
Add some info which might help a bit with debugging threading issues
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r-- | Source/SPDatabaseDocument.m | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 3b095f96..faabb2a8 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -113,9 +113,12 @@ enum { #import <SPMySQL/SPMySQL.h> +#include <libkern/OSAtomic.h> + // Constants static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; +static int64_t SPDatabaseDocumentInstanceCounter = 0; @interface SPDatabaseDocument () @@ -168,13 +171,14 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; @synthesize chooseDatabaseButton; @synthesize structureContentSwitcher; #endif +@synthesize instanceId; #pragma mark - - (id)init { if ((self = [super init])) { - + instanceId = OSAtomicIncrement64(&SPDatabaseDocumentInstanceCounter); #ifndef SP_CODA /* init ivars */ _mainNibLoaded = NO; @@ -594,7 +598,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [self startTaskWithDescription:NSLocalizedString(@"Restoring session...", @"Restoring session task description")]; if ([NSThread isMainThread]) - [NSThread detachNewThreadWithName:@"SPDatabaseDocument session load task" target:self selector:@selector(restoreSession) object:nil]; + [NSThread detachNewThreadWithName:SPCtxt(@"SPDatabaseDocument session load task",self) target:self selector:@selector(restoreSession) object:nil]; else [self restoreSession]; } @@ -779,7 +783,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; NSDictionary *selectionDetails = [NSDictionary dictionaryWithObjectsAndKeys:database, @"database", item, @"item", nil]; if ([NSThread isMainThread]) { - [NSThread detachNewThreadWithName:@"SPDatabaseDocument database and table load task" target:self selector:@selector(_selectDatabaseAndItem:) object:selectionDetails]; + [NSThread detachNewThreadWithName:SPCtxt(@"SPDatabaseDocument database and table load task",self) target:self selector:@selector(_selectDatabaseAndItem:) object:selectionDetails]; } else { [self _selectDatabaseAndItem:selectionDetails]; @@ -1023,7 +1027,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [self _addDatabase]; // Query the structure of all databases in the background (mainly for completion) - [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:databaseStructureRetrieval selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; + [NSThread detachNewThreadWithName:SPCtxt(@"SPNavigatorController database structure querier",self) target:databaseStructureRetrieval selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; } else { // Reset chooseDatabaseButton |