四、线程管理————NSThread

1、创建新线程的三种方式,例如:

NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(demo:) object:nil];
[thread start];
[NSThread detachNewThreadSelector:@selector(demo:) toTarget:self withObject:nil];
    [self performSelectorInBackground:@selector(demo:) withObject:nil]; 准确的说此方法是NSObject的

2、NSThread在调试中的使用

    ·    获得线程的属性:name,stackSize,threadPriority

    ·    管理线程的类方法:start、exit、sleep

    ·    获得当前线程和主线程:   [NSThread currentThread]  、[NSThread mainThread];

原文地址:https://www.cnblogs.com/David-SU/p/5274385.html