<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Matthew Flatt wrote at 07/04/2010 11:43 AM:<br>
<br>
[...]
<blockquote cite="mid:20100704154353.4CBD86500C7@mail-svr1.cs.utah.edu"
type="cite">
<pre wrap="">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.
</pre>
</blockquote>
[...]<br>
<br>
That sounds good to me. Perhaps along with Robby's suggestion of using
the process group when creating the subprocess.<br>
<br>
<blockquote cite="mid:20100704154353.4CBD86500C7@mail-svr1.cs.utah.edu"
type="cite">
<pre wrap="">Meanwhile, on the question of how to do this now:
</pre>
<blockquote type="cite">
<pre wrap="">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.
</pre>
</blockquote>
<pre wrap=""><!---->
That sounds ok. Also, you could use the FFI and scheme_add_managed().
</pre>
</blockquote>
<br>
I will look into this C call.<br>
<br>
If the custodian could've been used, that would've simplified things a
bit with the API of this library.<br>
<br>
<blockquote cite="mid:20100704154353.4CBD86500C7@mail-svr1.cs.utah.edu"
type="cite">
<pre wrap="">
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.
</pre>
</blockquote>
<br>
No urgency on my part. My production target for this particular code
is PLT Scheme 4.2.5 right now.<br>
<br>
Thanks, Matthew.<br>
<br>
<div class="moz-signature">-- <br>
<a class="moz-txt-link-freetext" href="http://www.neilvandyke.org/">http://www.neilvandyke.org/</a>
</div>
</body>
</html>