On 7/5/07, Lukas Mai <l.mai@web.de> wrote:
Hello, cafe!
I have the following code (paraphrased):
...
forkIO spin
...
spin = do
(t, _) <- accept s -- (*)
forkIO $ dealWith t -- (**)
spin
My problem is that I want to stop spin from another thread. The "obvious"
solution would be to throw it an exception. However, that leaks a socket
(t) if the exception arrives between (*) and (**). I could wrap the whole
thing in block, but from looking at the source of Network.Socket it seems
that accept itself is not exception safe; so no matter what I do, I can't
use asynchronous exceptions to make spin exit.