Thanks in advance to anyone who is helping me.
I've a simple daemon. I allocate a class and then start a scheduled & repeating NSTimer:
[NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(usage3GviaSysctl) userInfo:nil repeats:YES];
then I call CFRunLoopRun() so that my daemon will stay alive.
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
signal(SIGTERM, (sig_t)SIGTERM_handler);
helper = [[NMDaemonHelper alloc] init];
[helper startNotificationServer];
CFRunLoopRun();
NSLog(@"NMDAEMON: will exit");
[pool release];
return 0;
}
Now the problem is that after the timer fires I get a segfault. bt:
objc_msgSend
__NSFireTimer
__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
__CFRunLoopDoTImer
__CFRunLoopRun
CFRunLoopRunSpecific
other ways to start the timer didn't work either. for example:
NSTimer *timeUpdateTimer = [[NSTimer alloc] initWithFireDate:[NSDate date] interval:1 target:self selector:@selector(usage3GviaSysctl) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timeUpdateTimer forMode:NSDefaultRunLoopMode];
Has anybody an idea what's going (wr)on(g)?