<p>It is not the same thing, really, unless I'm misunderstanding. AFAIK there is no straightforward way of making the combined check-if-exists-and-delete block atomic at the bearsden level, even if you force serial execution at the haskell level, and the established solution is to forgo the existence check altogether, relying on the delete call to throw when the file doesn't exist.</p>

<div class="gmail_quote">On Jul 13, 2014 2:32 AM, "Vasili I. Galchin" <<a href="mailto:vigalchin@gmail.com">vigalchin@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
that was exactly my point ... I.e. if  between two lines the "Haskell<br>
thread-of-execution" is interrupted ... and another thread/process ...<br>
.deletes the file then 2nd "line" of code would cause an exception to<br>
be thrown ... i.e. because of non-existence .. . Brandon, aren't we<br>
saying the same thing ... if so, forgive, my English  .. :-)<br>
<br>
Vasya<br>
<br>
On Sat, Jul 12, 2014 at 7:02 PM, Brandon Allbery <<a href="mailto:allbery.b@gmail.com">allbery.b@gmail.com</a>> wrote:<br>
> On Sat, Jul 12, 2014 at 7:54 PM, Vasili I. Galchin <<a href="mailto:vigalchin@gmail.com">vigalchin@gmail.com</a>><br>
> wrote:<br>
>><br>
>> --  these two lines are non-thread safe     .. yes?? to be thread-safe<br>
>> the  above line and the following line would have to be together<br>
>> atomic ....<br>
><br>
><br>
> Not even then would it really be safe; it should trap the exception from<br>
> readFile failing, instead of checking existence in a separate step.<br>
><br>
> --<br>
> brandon s allbery kf8nh                               sine nomine associates<br>
> <a href="mailto:allbery.b@gmail.com">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net">ballbery@sinenomine.net</a><br>
> unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a><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>
</blockquote></div>