[RESOLVED] 'accept' behavior with an asynchronous exception inside of a 'block'

Cat Dancer ghc-users at catdancer.ws
Fri Dec 8 13:44:30 EST 2006

I had asked:
> If I use a network accept inside a block:
>   block (
>      ...
>      (clientSocket, sockAddr) <- accept serverSocket
>      ...
>      )
> and the 'accept' unblocks a pending asynchronous exception and the
> exception gets thrown, does this mean that the 'accept' won't have
> accepted a network connection?

Aha, I finally noticed this in this in the Control.Exception documentation:

> With takeMVar interruptible, however, we can be safe in the
> knowledge that the thread can receive exceptions *right up until
> the point when the takeMVar succeeds*. Similar arguments
> apply for other interruptible operations like openFile.

(emphasis added)

Which answers my question!  :-)

More information about the Glasgow-haskell-users mailing list