1.pthrad
//1.创建线程:传入线程和要执行的方法(run)
pthread_t thread;
pthread_create(&thread, NULL, run, NULL);
2.NSThrad
- (void)createThread3
{
[self performSelectorInBackground:@selector(run:) withObject:@"jack"];
}
- (void)createThread2
{
[NSThread detachNewThreadSelector:@selector(run:) toTarget:self withObject:@"rose"];
}
- (void)createThread1
{
// 创建线程
NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(run:) object:@"jack"];
// 启动线程
[thread start];
}
- (void)run:(NSString *)param
{
}