[Haskell-cafe] interrupting an accept()ing thread

Rich Neswold rich.neswold at gmail.com
Sat Jul 7 12:28:35 EDT 2007


On 7/7/07, Lukas Mai <l.mai at web.de> wrote:
>
> If I understand this correctly, spin should be written as:
>
> spin = do
>     block $ do
>         (t, _) <- accept s
>         unblock (forkIO $ doStuff t) `finally` sClose t
>     spin


I think the `finally` portion should be done in the forked process context.
Otherwise once the process is forked, the socket gets closed by the parent
process. Something more along the lines of:

unblock (forkIO $ doStuff t `finally` sClose t)

-- 
Rich

JID: rich at neswold.homeunix.net
AIM: rnezzy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070707/a1681977/attachment.htm


More information about the Haskell-Cafe mailing list