Re: Termination notifications in foundation tool?
Re: Termination notifications in foundation tool?
- Subject: Re: Termination notifications in foundation tool?
- From: Jens Alfke <email@hidden>
- Date: Fri, 4 Sep 2009 20:32:32 -0700
On Sep 4, 2009, at 7:34 PM, Greg Guerin wrote:
man 3 atexit
This is really difficult to use for anything serious since it's called
asynchronously, so you have no idea what state the main thread might
be in at the time. It's like running on a separate thread, only worse
because you can't wait for the main thread to continue (because you're
on the main thread, you just can't return back to it.)
What I've done in the past is install a signal handler which tells the
OS to ignore the signal, but also schedules a future callback on the
main thread (via the runloop) that will then cleanly shut down the
process. You probably want to catch the signals generated by Ctrl-C or
a 'kill' command; IIRC that would be SIGINT, but my memory is hazy.
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden