标签:开启 bsp 设置 ota san 创建 后台 nbsp name
1.获取当前线程
NSThread *current=[NSThread currentThread];
2.获取主线程的另外一种方式
NSThread *main=[NSThread mainThread];
3.创建一个新的线程
(1)直接创建
NSThread *thread=[[NSThread alloc]initWithTarget:self selector:@selector(run:) object:@"线程A"]; //为线程设置一个名称 thread.name=@"线程A"; //开启线程 [thread start];
(2)创建完线程自动启动
// NSThread *thread=[NSThread detachNewThreadSelector:@selector(run:) toTarget:self withObject:@"创建完线程直接(自动)启动"]; [NSThread detachNewThreadSelector:@selector(run:) toTarget:self withObject:@"创建完线程直接(自动)启动"];
(3)隐式创建
//在后台线程中执行===在子线程中执行 [self performSelectorInBackground:@selector(run:) withObject:@"隐式创建"];
标签:开启 bsp 设置 ota san 创建 后台 nbsp name
原文地址:http://www.cnblogs.com/huadeng/p/7011392.html