On Jan 18, 2012, at 3:13 PM, Keary Suska wrote:

> Any special handling of NSTask aside, Mac OS X uses Unix-based process 
> control which closes all child processes when the parent is closed.

No, that's not true.  Where did you get that?

Processes with a controlling terminal get a SIGHUP when that terminal is 
closed, and that will kill a naive process, but that wouldn't apply to 
subprocesses of GUI apps.  Other than that, child processes are independent of 
their parent process.

> Since your sub-program is Java you may be able to detach the child process.

This doesn't make sense to me.  What does being Java have to do with anything?

> This is usually accomplished by the sub-program by executing a low-level 
> fork(). It may need to be followed by an exec() to fully detach the process.

Fork() creates the child subprocess as a near duplicate of the parent.  Exec() 
replaces the process's image with a new one.  This is the standard means of 
creating a subprocess running a new program, but doesn't particularly "detach" 
an already-existing subprocess from its parent (whatever that might mean).

> Note that you can't do this with Cocoa/Objective-C (at least Apple says you 
> shouldn't…)

You can fork() and exec() just fine.  What you can't do is fork(), _not_ call 
exec(), and then do anything other than call POSIX async-cancel-safe APIs.  
That includes using high-level frameworks like Cocoa, Core Foundation, or the 
like.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to