码迷,mamicode.com
首页 > 编程语言 > 详细

四、线程管理————NSThread

时间:2016-03-14 07:06:11      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

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];

四、线程管理————NSThread

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!