[racket] adding other objects to custodian

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jul 5 17:59:11 EDT 2010

At Mon, 5 Jul 2010 08:13:46 -0500, Robby Findler wrote:
> On Mon, Jul 5, 2010 at 8:09 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> > At Sun, 4 Jul 2010 21:08:33 -0400, Sam Tobin-Hochstadt wrote:
> >> From a best effort perspective, I think sending the signal to the
> >> process group is more custodian-like.
> >
> > I'm not sure I understand this suggestion, either. Do you mean that
> > Racket should create a process group for each subprocess that it
> > launches? Wouldn't that interfere with the role of process groups for
> > job control in a shell?
> 
> I don't understand all of the issues here, but could one use the value
> of the parameter when creating a custodian to mean "create a process
> group for all processes created under the auspicies of this custodian
> so that I can 'try harder' to clean them all up when the custodian is
> shut down"?

A draft version 5.0.0.7 (not yet pushed) includes a
`subprocess-group-enabled' parameter that determines whether
`subprocess' creates a process as a new progress group.

I had the process-group setting tangled with the custodian parameter at
first, but it's really orthogonal, and so a new parameter seemed
better.


The Unix API forces a limitation that I had not anticipated: If you ask
about the status of the main subprocess, and if the answer is that the
subprocess is done, then you no longer have the ability to shut down
the process group. That's because getting a "done" result also counts
as releasing access to the process in the form of its process id.
(Since the process id can be reused, there's no guarantee that the
process id as a group refers to the original group --- and any
processes that might be in the group).

A workaround that uses an extra process could be implemented in a
library, eventually.



Posted on the users mailing list.