[racket] adding other objects to custodian

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Mon Jul 5 09:31:02 EDT 2010

Matthew Flatt wrote at 07/04/2010 11:43 AM:

[...]
> With all that in mind, I don't think there's a good default behavior that tries to terminate a subprocess when a custodian is shut down. We could add a parameter that determines how `subprocess' interacts with the custodian: SIGINT, SIGKILL, or nothing (i.e., the current behavior). I think the default should be nothing; having to set a parameter encourages a programmer to become informed on the issues of OS-level processes --- or, at least, explicitly accept best-effort termination that could just as well make things worse instead of better.
>   
[...]

That sounds good to me.  Perhaps along with Robby's suggestion of using 
the process group when creating the subprocess.

> Meanwhile, on the question of how to do this now:
>
>   
>> Currently, I create a custodian for the thread and explicitly call "custodian-shutdown-all" at the end of the thread's lifetime (in a "dynamic-wind" cleanup thunk).
>>
>> Ideally, I would like to use this same custodian to kill the subprocess, but I do not see how.  "make-custodian-box" does not seem to involve "custodian-shutdown-all" evaluating a closure in the box or executing a will.
>>
>> If using the current custodian is not possible, then I think I have to do something like make a will executor and execute it from my "dynamic-wind" cleanup thunk.
>>     
>
> That sounds ok. Also, you could use the FFI and scheme_add_managed().
>   

I will look into this C call.

If the custodian could've been used, that would've simplified things a 
bit with the API of this library.

> I started to suggest that you use custodian boxes and have a thread that waits until a box is emptied to terminate the corresponding process. That would work better if custodian boxes were synchronizable events; I will make custodian boxes act as events, so that strategy could work in the future.
>   

No urgency on my part.  My production target for this particular code is 
PLT Scheme 4.2.5 right now.

Thanks, Matthew.

-- 
http://www.neilvandyke.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100705/b592df35/attachment.html>

Posted on the users mailing list.