Re: How to terminate an NSTask whenever my app terminates?
Re: How to terminate an NSTask whenever my app terminates?
- Subject: Re: How to terminate an NSTask whenever my app terminates?
- From: Scott Ribe <email@hidden>
- Date: Tue, 01 Sep 2015 07:27:39 -0600
On Aug 31, 2015, at 10:55 PM, Ken Thomases <email@hidden> wrote:
>
> Try the following program. The parent will print the child's PID and exit (by falling out of main()). Then do a "ps xww -p <the child PID>". You'll see the child is still running. You can kill it when satisfied.
Yep, I got it backwards. Nothing special for the child to keep running, special to make it die.
Simple old trick is to periodically check ppid to see if it changed. OSX specific way, and not requiring any nasty polling loop, is to use kqueue and an EVFILT_PROC for NOTE_EXIT. I don't know if there's any Cocoa or CF equivalent.
Sorry for the confusion, this is actually something I've gotten backwards before. I've written the code for the child to monitor for the parent's exit, yet I still forget that it's necessary. Go figure...
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice
_______________________________________________
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