<div><br></div><br><br><div class="gmail_quote">On 17 October 2012 00:17, Mike Meyer <span dir="ltr"><<a href="mailto:mwm@mired.org" target="_blank">mwm@mired.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, 16 Oct 2012 21:55:44 +0200<br>
Alexander Kjeldaas <<a href="mailto:alexander.kjeldaas@gmail.com">alexander.kjeldaas@gmail.com</a>> wrote:<br>
<br>
> There are variants of this, but the meta-problem is that at the point in<br>
> time when you call forkProcess, you must control all threads, ensuring that<br>
</div>> *all invariants hold*. Thus no locks held, no thread is in the C library,<br>
<div class="im">> no foreign calls active etc. As an example, if one thread is in the C<br>
> library doing some stdio, then the invariants in that library will not<br>
> hold, and you cannot expect stdio to work in the child. This means that<br>
> the only thing you can really do in the child process is call exec.<br>
<br>
</div>Further, you can only call exec if you make sure that the exec<br>
correctly reverts everything back to a state where those invariants<br>
hold. Mostly, this is automatic as resources get freed on exec and "do<br>
the right thing." Locks on file descriptors that aren't closed on exec<br>
will leave dangling locks, and locks on files that are closed on exec<br>
will unexpectedly close them in the parent.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Right. It should be renamed mostlyUnsafeForkProcess, assuming the multi-threaded RTS is "mostly" the default one.</div>
<div><br></div><div>Alexander</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
<mike<br>
--<br>
Mike Meyer <<a href="mailto:mwm@mired.org">mwm@mired.org</a>> <a href="http://www.mired.org/" target="_blank">http://www.mired.org/</a><br>
Independent Software developer/SCM consultant, email for more information.<br>
<br>
O< ascii ribbon campaign - stop html mail - <a href="http://www.asciiribbon.org" target="_blank">www.asciiribbon.org</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>