Use NSOperation's maxConcurrentOperationCount

This commit is contained in:
Nathan Kinsinger
2010-03-28 17:15:23 -06:00
parent 0eb011b8d9
commit cd9d469eda
2 changed files with 2 additions and 8 deletions
-1
View File
@@ -31,7 +31,6 @@
PBGitHistoryGrapher *grapher;
NSOperationQueue *graphQueue;
NSInvocationOperation *lastOperation;
NSMutableArray *commits;
BOOL isUpdating;
+2 -7
View File
@@ -131,8 +131,8 @@
if (graphQueue)
[graphQueue removeObserver:self forKeyPath:@"operations"];
graphQueue = [[NSOperationQueue alloc] init];
[graphQueue setMaxConcurrentOperationCount:1];
[graphQueue addObserver:self forKeyPath:@"operations" options:0 context:@"operations"];
lastOperation = nil;
grapher = [self grapher];
}
@@ -140,12 +140,7 @@
- (NSInvocationOperation *) operationForCommits:(NSArray *)newCommits
{
NSInvocationOperation *graphOperation = [[NSInvocationOperation alloc] initWithTarget:grapher selector:@selector(graphCommits:) object:newCommits];
if (lastOperation)
[graphOperation addDependency:lastOperation];
lastOperation = graphOperation;
return graphOperation;
return [[NSInvocationOperation alloc] initWithTarget:grapher selector:@selector(graphCommits:) object:newCommits];
}