开发者

does the one thread kill the other in a iphone application( both thread are main thread)?

HI guys,

==>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 class ==>one in the root view controller ==>all the thread having different sleep time

My question is that does any thread may get killed by the other and the invocation time for one thread get affected by the other?

-(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 *objPostSyncDa开发者_StackOverflow中文版ta=[[PostSyncData alloc]init];
[objPostSyncData release];    
}


The Apple reference documents on the use of the method - (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait states

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜