-
-
Save tobiastom/4124735 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppDelegate.h" | |
@implementation AppDelegate | |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification | |
{ | |
// Insert code here to initialize your application | |
dispatch_queue_t the_queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); | |
NSArray *array = [NSArray arrayWithObjects:@"a", @"b", @"c", @"d", @"e", @"f", nil]; | |
dispatch_apply(array.count, the_queue, ^(size_t i) { | |
NSString *lala = [array objectAtIndex:i]; | |
// perform some async stuff here with the string | |
}); | |
NSLog(@"done"); | |
} | |
@end | |
/* | |
2012-11-21 13:57:17.080 test[46156:303] done | |
2012-11-21 13:57:17.077 test[46156:303] d | |
2012-11-21 13:57:17.077 test[46156:2707] a | |
2012-11-21 13:57:17.077 test[46156:1203] b | |
2012-11-21 13:57:17.077 test[46156:1803] c | |
2012-11-21 13:57:17.077 test[46156:6603] f | |
2012-11-21 13:57:17.077 test[46156:6403] e | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment