Skip to content

Instantly share code, notes, and snippets.

@jeena
Created November 21, 2012 12:58
Show Gist options
  • Save jeena/4124732 to your computer and use it in GitHub Desktop.
Save jeena/4124732 to your computer and use it in GitHub Desktop.
#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) {
NSLog(@"%@", [array objectAtIndex:i]);
});
NSLog(@"done");
}
@end
/*
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
2012-11-21 13:57:17.080 test[46156:303] done
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment