多线程pthread

#import <pthread.h>

@interface ViewController ()

 

@end

 

@implementation ViewController

void * run(void *param){

    

    for (int i=0; i<50000; i++) {

        NSLog(@"run%@",[NSThread currentThread]);

    }

 

    

    

    return NULL;

}

- (IBAction)action:(id)sender {

    pthread_t thread;

    pthread_create(&thread, NULL, run, NULL);

    

    

}

posted @ 2016-04-24 16:05  谢小锋  阅读(127)  评论(0)    收藏  举报