site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meg.abyt.es; s=google; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=FDSVGTSEBxVLbzJOIdHwiOtiEoBlQhBOMQOlk1bmS1o=; b=f5gqrEwfsOjAx/4C4qCxYOWCaHFeheilGB6jQaW63B2bWAyMI4AFBpjLBeMehgUp8m 0ZsYaUw9udaqf7NpsHIAV7qJ221SDKvryDEyc/n9oqoqVE47klwcTqzqqAm5dtoQRd1e UsMHnnPKe6a/vl2fX2QYPQ6cdW7Eqlz+fOmkk= On Wed, Nov 2, 2011 at 1:57 PM, Jason Coco <jason@9mmedia.com> wrote:
I believe it's designed to allow short-lived processes to complete whatever service they're providing if the parent dies unexpectedly, not for when the parent exits and basically says "okay, I'm all done," like in your case. An example might be an http daemon that uses processes to service individual requests. If the daemon process dies, the child processes are given a chance to complete their service and exit before being killed and reaped by launchd.
If the OP is wanting to do things in parallel, however, he might try to call waitpid() in the parent before exiting. Another possible solution might be to sleep(1) before exiting in the parent. It might be enough to trick launchd into thinking that the process wasn't simply doing the "moral equivalent" of daemon(3) (see the launchd.plist manpage). And finally, a third solution might be to call setsid() in the child prior to the execl(). This will ensure the child has a different process group ID, thus avoiding the issue with launchd killing processes with the same process group ID. One caveat: ensure the parent sleep()s before exit()ing, or the exit of the parent may occur before the child has a chance to setsid(). _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com