码迷,mamicode.com
首页 > 编程语言 > 详细

帮你理解多线程

时间:2014-05-07 21:37:21      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:int   c   for   log   a   ide   

static BOOL flag=NO;
    
    
    dispatch_queue_t myQueue=dispatch_queue_create("identifier", NULL);
    
    dispatch_async(myQueue, ^{
        
        for (int i=0; i<10; i++) {
            NSLog(@"%d",i);
        }
        flag=YES;
    });
    
    
    
    
    
    NSLog(@"before");
    
    while (!flag){
        NSLog(@"after");
        
    }
    NSLog(@"after2");
    
    return;

帮你理解多线程,布布扣,bubuko.com

帮你理解多线程

标签:int   c   for   log   a   ide   

原文地址:http://blog.csdn.net/learnios/article/details/25233993

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