On Jul 23, 2008, at 2:09 PM, Karl Moskowski wrote:

void handleSignal (int signal) {
        NSLog(@"Shutting daemon down");

        AnObject * anObject = [[AnObject alloc] init];
        [anObject doCleanup];

[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"DaemonHasShutDown" object:nil userInfo:nil options:NSNotificationPostToAllSessions];
        exit(EXIT_SUCCESS);
}
int main (int argc, const char * argv[]) {
        signal (SIGTERM, handleSignal);
        signal (SIGINT, handleSignal);


Calling ObjC methods in a signal handler is not a good idea: <http://lists.apple.com/archives/Cocoa-dev/2001/Dec/msg00159.html >

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to