[Haskell-cafe] Cleaning up threads

Gregory Collins greg at gregorycollins.net
Wed Sep 15 01:38:10 EDT 2010

Bas van Dijk <v.dijk.bas at gmail.com> writes:

> Don't forget to block asynchronous exception _before_ you fork in:
>>        tid <- forkIO (someWorkToDo `finally` putMVar mv ())
> Otherwise an asynchronous exception might be thrown to the thread
> _before_ the 'putMVar mv ()' exception handler is installed leaving
> your main thread in a dead-lock!

Good catch, thank you,

Gregory Collins <greg at gregorycollins.net>

More information about the Haskell-Cafe mailing list