Skip to content
Snippets Groups Projects
Commit fc3297d5 authored by Niklas Hambüchen's avatar Niklas Hambüchen Committed by Herbert Valerio Riedel
Browse files

Add comment why `closeFd` doesn't have to retry on EINTR. Fixes #88

parent afc6dd9b
No related branches found
No related tags found
No related merge requests found
......@@ -221,6 +221,12 @@ foreign import capi unsafe "HsUnix.h open"
closeFd :: Fd -> IO ()
closeFd (Fd fd) = throwErrnoIfMinus1_ "closeFd" (c_close fd)
-- Here we don't to retry on EINTR because according to
-- http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
-- "with errno set to [EINTR] [...] the state of fildes is unspecified"
-- and on Linux, already the first close() removes the FD from the process's
-- FD table so closing a second time is invalid
-- (see http://man7.org/linux/man-pages/man2/close.2.html#NOTES).
foreign import ccall unsafe "HsUnix.h close"
c_close :: CInt -> IO CInt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment