码迷,mamicode.com
首页 > 其他好文 > 详细

GCD

时间:2015-03-02 18:10:02      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

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(@“zurenwu”组任务1);
});
dipatch_group_async(group, queue, ^(void) {
    [NSThead sleepForTimeInterval:1];
    NSLog(@“zurenwu”组任务2);
});
dispatch_group_notify(group, dispatch_get_main_queue(), ^(void) {
    NSLog(“Update UI”);;
});
dispatch_release(group);

 

GCD

标签:

原文地址:http://www.cnblogs.com/apem/p/4309000.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!