[Haskell-cafe] Spurious program crashes

Keean Schupke k.schupke at imperial.ac.uk
Mon Nov 21 11:34:54 EST 2005

One thing, which I am sure you must have got right, but which burned me, 
is that you must explicitly free enitities created by FFI calls.

For example network sockets exist outside of the haskell runtime, and 
are not free'd automatically when a haskell thread is killed, you need 
an explicit exception handler to close the handle... They may eventually 
be garbage collected - but your application may run out of resources 
before this happens.


Joel Reymont wrote:

> Maybe one of the Simons can comment on this. I distinctly remember  
> trying the mdo approach to kill the other thread and getting burned  
> by that. Don't know why I forgot to mention it.
> On Nov 17, 2005, at 2:03 PM, Sebastian Sylvan wrote:
>> What I do remember is that the timeout and parIO functions in the
>> concurrent programming papers I found were NOT correct. killThread did
>> NOT behave as expected when I killed an already killed thread.
>> I tried multiple tricks here (including some which required recursive
>> do-notation) to try to get the parIO function to only kill the *other*
>> thread.
>> This could be done by having the two spawned threads take their
>> computations in an MVar along with the threadID of the other thread.
> -- 
> http://wagerlabs.com/
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list