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 timeMy 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.
精彩评论