Safe Signal Handling from the Run Loop
Safe Signal Handling from the Run Loop
- Subject: Safe Signal Handling from the Run Loop
- From: Dave Keck <email@hidden>
- Date: Sun, 19 Apr 2009 10:01:06 -1000
Hey list,
Earlier today I spent awhile trying to re-find some sample code that I
discovered awhile ago. I eventually found it, and thought I would
mention it here in hopes that it'll help someone in the future.
It allows you to handle signals safely within your app's runloop,
rather than trying to muck around within the signal handler with all
the issues that entails. Check it out here:
http://developer.apple.com/SampleCode/PreLoginAgents/listing2.html
The function's called InstallHandleSIGTERMFromRunLoop. It's 10.5-only,
because it uses some new facilities like CFFileDescriptor and some new
kevent stuff. It could be easily modified to handle other signals, or
rewritten to be more Cocoa-esque. Anyway, it's pretty much the best
code snippet ever.
David
_______________________________________________
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