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

Bas van Dijk v.dijk.bas at gmail.com
Thu Apr 8 19:56:38 EDT 2010


On Thu, Apr 8, 2010 at 11:45 PM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> On Thu, Apr 8, 2010 at 9:15 PM, Isaac Dupree
> <ml at isaac.cedarswampstudios.org> wrote:
>> I still would like to see examples of where it's needed, because I slightly
>> suspect that wrapping possibly-blocking operations in an exception handler
>> that does something appropriate, along with ordinary 'mask', might be
>> sufficient... But I expect to be proved wrong; I just haven't figured out
>> how to prove myself wrong.
>
> Take my threads package, I uploaded to hackage yesterday, as an example.
>
> In Control.Concurrent.Thread.Group.fork...

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.

regards,

Bas


More information about the Libraries mailing list