四、线程管理————NSThread

mac2022-06-30  117

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

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)