summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Szamotulski <profunctor@pm.me>2021-02-04 09:55:19 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-13 21:30:09 -0500
commita5ec3515a4a177d4dbda116b68eb810fa62c573f (patch)
tree9a39a9a7f18c20589a855eb5ee8f76cb0db6c209
parent83ace021a33fb6f4ce940f969467d6712cbaa858 (diff)
downloadhaskell-a5ec3515a4a177d4dbda116b68eb810fa62c573f.tar.gz
closeFd: improve documentation
I think it is worth to say that closeFd is interruptible by asynchronous exceptions. And also fix indentation of closeFd_.
-rw-r--r--libraries/base/GHC/Event/Manager.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/libraries/base/GHC/Event/Manager.hs b/libraries/base/GHC/Event/Manager.hs
index dd133798d7..1564c4f0f3 100644
--- a/libraries/base/GHC/Event/Manager.hs
+++ b/libraries/base/GHC/Event/Manager.hs
@@ -402,7 +402,8 @@ unregisterFd mgr reg = do
wake <- unregisterFd_ mgr reg
when wake $ wakeManager mgr
--- | Close a file descriptor in a race-safe way.
+-- | Close a file descriptor in a race-safe way. It might block, although for
+-- a very short time; and thus it is interruptible by asynchronous exceptions.
closeFd :: EventManager -> (Fd -> IO ()) -> Fd -> IO ()
closeFd mgr close fd = do
fds <- withMVar (callbackTableVar mgr fd) $ \tbl -> do
@@ -423,9 +424,9 @@ closeFd mgr close fd = do
-- holds the callback table lock for the fd. It must hold this lock because
-- this command executes a backend command on the fd.
closeFd_ :: EventManager
- -> IntTable [FdData]
- -> Fd
- -> IO (IO ())
+ -> IntTable [FdData]
+ -> Fd
+ -> IO (IO ())
closeFd_ mgr tbl fd = do
prev <- IT.delete (fromIntegral fd) tbl
case prev of