[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

Isaac Dupree ml at isaac.cedarswampstudios.org
Thu Apr 8 21:22:34 EDT 2010


On 04/08/10 19:56, Bas van Dijk wrote:
> Control.Concurrent.Thread.fork is a similar and simpler example of why
> nonInterruptibleMask is needed:
>
> http://hackage.haskell.org/packages/archive/threads/0.1/doc/html/src/Control-Concurrent-Thread.html#fork
>
> If an asynchronous exception is thrown during the 'putMVar res' any
> waiters on the thread will never be woken up.

OK, thanks for the link!  In fact, [tell me if my reasoning is 
wrong...], in that fork-definition, the 'putMVar' will never block, 
because there is only putMVar one for each created MVar.  I seem to 
remember that any execution of putMVar that does not *actually* block is 
guaranteed not be interrupted by asynchronous exceptions (if within a 
Control.Exception.block) -- which would be sufficient.  Is my memory 
right or wrong?

-Isaac


More information about the Haskell-Cafe mailing list