I get a problem
here is the code
- (void)start{
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantFuture]];
}
- (void)nlog{
NSLog(@"cool");
}
- (void)main{
thread = [[NSThread alloc] initWithTarget:self selector:@selector(start) object:nil];
[thread start];
[self performSelector:@selector(nlog) onThread:thread withObject:nil waitUntilDone:NO];
}
when I call
[self performSelector:@selector(nlog) onThread:thread withObject:nil waitUntilDone:NO];
the thread will keeping running and I can do something in the thread later;
but if I don't call it, the thread will exit at once and can never use the thread do anything, why?