#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);
}
时间: 2024-10-05 04:44:47