[self request]; //main thread
- (void)request {
[self performSelectorInBackground:@selector(regFun) withObject:nil];
}
- (void)regFun {
CFRunLoopRun();
CCLOG(@"CFRunLoopRun not work");
}
Given the previous code, do you know why CFRunLoopRun()
is not working?. I need to call regFun
in background.
Are there any other ways to stop background thread?
regFun
is in a background thread, so the call toCFRunLoopRun()
creates and runs a run loop in this thread. Only there's nothing attached to the run loop, so it exits immediately.