aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CustomQuery.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-11-08 22:58:56 +0000
committerrowanbeentje <rowan@beent.je>2009-11-08 22:58:56 +0000
commit8f3065bb99ff46ddfcffdd05eb55e09871cad0c9 (patch)
tree0e580a5c151e6933c95c0b8417ae44f8c8f8acb4 /Source/CustomQuery.m
parent55bf19f025ab67562b151a40e2440c5c76b00ee5 (diff)
downloadsequelpro-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.m10
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];