Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Signal handlers

Signal handlers
Thread Tools
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jan 28, 2003, 09:19 PM
 
Is it safe to install signal handlers using signal(2) in a Foundation application? I'm writing a daemon and have installed handlers for SIGHUP (to reload config) and SIGTERM (to clean up a file in /var/run).

Also, is it preferable to use daemon() and then close stdin, stdout, and stderr (so NSLog() uses syslog) rather than forking, exiting parent, setting session id, etc.?

--
Terry
     
int69h  (op)
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jan 31, 2003, 05:58 AM
 
Nobody has written a daemon using Foundation? I'm kind of worried about NSExceptions, longjmp, and the signal handlers not getting along with each other. If nobody knows, I'll post the answer if I ever find one.
     
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Jan 31, 2003, 02:46 PM
 
When I ported Chicken of the VNC to OS X, it used signal handlers. I eventually removed them because of a bad interaction with Unsanity's WindowShade X.

They seemed to work fine other than that, though.

But I'm just guessing...
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jan 31, 2003, 05:40 PM
 
There was some long discussion on this topic some months back on macosx-dev. Might make for interesting reading.
     
int69h  (op)
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jan 31, 2003, 06:32 PM
 
That thread made for very interesting reading. It opened my eyes to all new ways for my program to die a horrible death. I hadn't thought about Foundation spawning new threads on my behalf. Thanks Foundation.

Maybe I'll have better luck using CoreFoundation. If not, I'll just have to reinvent a few wheels. OO is overrated anyways

Thanks.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:07 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2