Hi!

On Sat, Dec 25, 2010 at 2:32 AM, Edward Z. Yang <[email protected]> wrote:
> In particular, we should explicitly note the race conditions
> for not just swapMVar but also readMVar, withMVar, modifyMVar_ and modifyMVar,

I am not sure if this are really race conditions? The point is that
readMVar, withMVar and others do not return until they can return the
value back and after that the value is the same as it was at the
beginning of the call. So if somebody manages to put the value in then
those functions wait that the value is removed.

Race condition would mean for me that some other thread could corrupt
the data. This is not the case here.

So I would argue that it would be better to write that those function
can block. Not that there are race-conditions. Race-conditions (for
me) imply that invariants can change based on some other thread, here
they hold, when/if the function returns.

This is why I proposed tryReadMVar and tryModifyMVar here:

http://hackage.haskell.org/trac/ghc/ticket/4535


Mitar

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to