标签:
dispatch_async(dispatch_get_main_queue, ^(void) { }); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) { }); static dispatch_once_t dipatch_once; static NSOjbect *obj; dipatch_once(&dipatch_once, ^(void) { obj = [[NSOjbect alloc] init]; }); dipatch_time_t time_token = dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SECOND); dispatch_after(time_token, dispatch_get_main_queue(), ^(void) { }); //组发配 dipatch_queue_t queue = dispatch_get_global_qeueu(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_group_t group = dispatch_group_create(); dipatch_group_async(group, queue, ^(void) { [NSThead sleepForTimeInterval:1]; NSLog(@“zu‘ren‘wu”组任务1); }); dipatch_group_async(group, queue, ^(void) { [NSThead sleepForTimeInterval:1]; NSLog(@“zu‘ren‘wu”组任务2); }); dispatch_group_notify(group, dispatch_get_main_queue(), ^(void) { NSLog(“Update UI”);; }); dispatch_release(group);
标签:
原文地址:http://www.cnblogs.com/apem/p/4309000.html