当前位置:首页 > 操作系统 > Ios

IOS第一天多线程-01pthread

***

            #import
            "
            HMViewController.h
            "
            #import <pthread.h>

@interface HMViewController ()

@end@implementation HMViewController

void *run(void *data)
{
    for (int i = 0; i<10000; i++) {
        NSLog(@"touchesBegan----%d-----%@", i, [NSThread currentThread]);
    }
    return NULL;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    // 创建线程    pthread_t myRestrict;
    pthread_create(&myRestrict, NULL, run, NULL);
}

@end

 

原文:http://www.cnblogs.com/ios-g/p/4792474.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!