[Haskell-cafe] Re: [reactive] problem with unamb -- doesn't kill enough threads

Thomas Davie tom.davie at gmail.com
Sat Dec 20 06:14:45 EST 2008

On 20 Dec 2008, at 12:00, Peter Verswyvelen wrote:

> I see. Of course, how silly of me, killThread is asynchronous, it  
> only waits until the exception is raised in the receiving thread,  
> but it does not wait until the thread is really killed. The  
> documentation does not seem to mention this explicitly.
> Now, what would be the clean way to make sure all threads are indeed  
> killed before the process quits? I tried to add another MVar that  
> gets set after the thread handles uncatched exceptions (so something  
> like bracket (forkIO a) (putMVar quit ()) return) and the code that  
> calls killThread then does takeMVar quit, but this did not solve  
> the  problem.

I'm not sure I understand what the "problem" is – if the process has  
died, why do we want to kill threads?


More information about the Haskell-Cafe mailing list