[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity
Isaac Dupree
ml at isaac.cedarswampstudios.org
Fri Mar 26 15:51:42 EDT 2010
On 03/25/10 12:36, Simon Marlow wrote:
> I'd also be amenable to having block/unblock count nesting levels
> instead, I don't think it would be too hard to implement and it wouldn't
> require any changes at the library level.
Wasn't there a reason that it didn't nest?
I think it was that operations that block-as-in-takeMVar, for an
unbounded length of time, are always supposed to C.Exception.unblock and
in fact be unblocked within that operation. Otherwise the thread might
never receive its asynchronous exceptions.
Thus, if within a C.Exception.block, you call an IO that might block,
such as takeMVar, modifyMVar_, or an arbitrary "IO x" argument to your
function, then you must take care to handle its exceptions (for example,
in the case of modifyMVar_'s implementation, to rollback the MVar to its
previous value).
-Isaac
More information about the Haskell-Cafe
mailing list