PThread-5

在storyBoard拖拽button TextView

绑定按钮方法

-(IBAction*)buttonClick:(id)sender{

//创建线程

pthread_t  thread;

//参数1:phread_t *restrict  thread的地址

//参数2:const pthread_attr_t *restrict 线程的属性

//参数3:void *(*)(void *) 传递一个函数

//参数4:void *restrict --函数传值

pthread_create(&thread,NULL,,NULL)

}

void *run(void *param){

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

NSLog(@"-----buttonClick ---%ld",i);

}

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

return NULL;

}

你可能感兴趣的:(PThread-5)