[NSOperation cancelAllOperations]; не останавливает операцию
xCode 4.4.1 OSX 10.8.2, выглядит как [операция cancelAllOperations]; не работает
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSOperationQueue *operation = [[NSOperationQueue alloc] init];
[operation setMaxConcurrentOperationCount: 1];
[operation addOperationWithBlock: ^{
for (unsigned i=0; i < 10000000; i++) {
printf("%i\n",i);
}
}];
sleep(1);
if ([operation operationCount] > 0) {
[operation cancelAllOperations];
}
}
результаты 9999999