'accept' behavior with an asynchronous exception inside of a 'block'

Chris Kuklewicz suggested I direct this question to the developers ^_^ 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? Certainly this seems like desirable behavior, since if the 'accept' call might accept a network connection and *then* raise the asynchronous exception, the reference to the accepted connection would be lost. However I couldn't tell from the library documentation whether this was intended to be a guarantee of the 'accept' function or not.

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! :-)
participants (1)
-
Cat Dancer