diff options
author | rowanbeentje <rowan@beent.je> | 2009-11-08 22:58:56 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-11-08 22:58:56 +0000 |
commit | 8f3065bb99ff46ddfcffdd05eb55e09871cad0c9 (patch) | |
tree | 0e580a5c151e6933c95c0b8417ae44f8c8f8acb4 /Source/CustomQuery.m | |
parent | 55bf19f025ab67562b151a40e2440c5c76b00ee5 (diff) | |
download | sequelpro-8f3065bb99ff46ddfcffdd05eb55e09871cad0c9.tar.gz sequelpro-8f3065bb99ff46ddfcffdd05eb55e09871cad0c9.tar.bz2 sequelpro-8f3065bb99ff46ddfcffdd05eb55e09871cad0c9.zip |
- Support nested task levels to allow tasks to overlap
- Thread history loading, thus using the nested task elvels and fixing history interaction in recent builds
- Thread initial database loads
- Improve progress indicator slightly
Diffstat (limited to 'Source/CustomQuery.m')
-rw-r--r-- | Source/CustomQuery.m | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index 93567aa5..55c87129 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -364,7 +364,13 @@ if (customQueryCallbackMethod) encodedCallbackMethod = [NSValue valueWithBytes:&customQueryCallbackMethod objCType:@encode(SEL)]; NSDictionary *taskArguments = [NSDictionary dictionaryWithObjectsAndKeys:queries, @"queries", encodedCallbackMethod, @"callback", nil]; - [NSThread detachNewThreadSelector:@selector(performQueriesTask:) toTarget:self withObject:taskArguments]; + + // If a helper thread is already running, execute inline - otherwise detach a new thread for the queries + if ([NSThread isMainThread]) { + [NSThread detachNewThreadSelector:@selector(performQueriesTask:) toTarget:self withObject:taskArguments]; + } else { + [self performQueriesTask:taskArguments]; + } } - (void)performQueriesTask:(NSDictionary *)taskArguments @@ -745,7 +751,7 @@ // Set up the callback if present if ([taskArguments objectForKey:@"callback"]) { [[taskArguments objectForKey:@"callback"] getValue:&callbackMethod]; - [self performSelectorOnMainThread:callbackMethod withObject:nil waitUntilDone:NO]; + [self performSelectorOnMainThread:callbackMethod withObject:nil waitUntilDone:YES]; } [tableDocumentInstance endTask]; |