编程技术网

关注微信公众号,定时推送前沿、专业、深度的编程技术资料。

 找回密码
 立即注册

QQ登录

只需一步,快速开始

一个线程会杀死iPhone应用程序中的另一个线程(两个线程都是主线程)?:does the one thread kill the other in a iphone application( both thread are main thread)?

angrycans 线程 2022-5-13 10:21 44人围观

腾讯云服务器
一个线程会杀死iPhone应用程序中的另一个线程(两个线程都是主线程)?的处理方法

==>在我的应用程序中,我使用了三种不同的线程代码,其中所有线程都是同一类型==>我在appdelegate类中定义了两个线程==>根视图控制器中的一个==>所有线程具有不同的睡眠时间

==>in my application i have used three different thread code for one of them is here all thread are of same kind ==>i have defined two thread in appdelegate in the root view controller ==>all the thread having different sleep time

我的问题是,是否有任何线程会被另一个线程杀死,而一个线程的调用时间会受到另一个线程的影响?

-(void)PostData { NSAutoreleasePool *apool = [[NSAutoreleasePool alloc] init];// we are responsible for the memory pool while(TRUE) { [self performSelectorOnMainThread:@selector(PostAllthedata) withObject:nil waitUntilDone:YES]; [NSThread sleepForTimeInterval:150]; } [apool release]; } -(void)PostAllthedata { PostSyncData *objPostSyncData=[[PostSyncData alloc]init]; [objPostSyncData release]; } 

问题解答

从相同的线程导致相应的选择器排队和执行以相同的顺序打电话了.

Multiple calls to this method from the same thread cause the corresponding selectors to be queued and performed in the same same order in which the calls were made.

这篇关于一个线程会杀死iPhone应用程序中的另一个线程(两个线程都是主线程)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程技术网(www.editcode.net)!

腾讯云服务器 阿里云服务器
关注微信
^