在storyBoard拖拽button TextView
綁定按鈕方法
-(IBAction*)buttonClick:(id)sender{
//創(chuàng)建線程
pthread_t? thread;
//參數(shù)1:phread_t *restrict? thread的地址
//參數(shù)2:const pthread_attr_t *restrict 線程的屬性
//參數(shù)3:void *(*)(void *) 傳遞一個函數(shù)
//參數(shù)4:void *restrict --函數(shù)傳值
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;
}