Re: Launchd, AbandonProcessGroup, system() vs fork/exec
Re: Launchd, AbandonProcessGroup, system() vs fork/exec
- Subject: Re: Launchd, AbandonProcessGroup, system() vs fork/exec
- From: Jason Coco <email@hidden>
- Date: Wed, 02 Nov 2011 12:08:33 -0400
I'm assuming that your main program exits relatively quickly after calling system(3) or execl(3). You simply *can't* do this when using launchd. The reason it appears to work in the first case is that system(3) actually blocks until the new process exits. This keeps your process alive during the entire life of the child, which is what launchd expects and wants, making it appear to work correctly (although none of your subsequent instructions get processed until after the system(3) call returns, so you're not actually doing any work in parallel). With exec(3), your process probably returns before the child, which launchd isn't going to be very happy with. Depending on what you're doing, it may just be best to keep your main process around until all its children are finished, and then exit cleanly after reaping them.
--
Jason Coco
iOS Applications
627 Broadway, 9th Floor
New York, NY 10012
On Tuesday, November 1, 2011 at 18:45 , Todd Heberlein wrote:
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden