[commit: base] master: Fix hClose002 with the threaded RTS IO manager (80b02b2)
Ian Lynagh
igloo at earth.li
Sun Jun 16 21:43:36 CEST 2013
Repository : ssh://darcs.haskell.org//srv/darcs/packages/base
On branch : master
https://github.com/ghc/packages-base/commit/80b02b2a1ebd84c853a9479a7a36c923058e7ce8
>---------------------------------------------------------------
commit 80b02b2a1ebd84c853a9479a7a36c923058e7ce8
Author: Ian Lynagh <ian at well-typed.com>
Date: Sun Jun 16 20:16:19 2013 +0100
Fix hClose002 with the threaded RTS IO manager
If 'close fd' failed, then the MVars in the callbackTables would be
left empty, which caused deadlocks when we tried to 'take' them again.
Now we use 'finally' to ensure that they are refilled even if 'close'
throws an exception.
>---------------------------------------------------------------
GHC/Event/Thread.hs | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/GHC/Event/Thread.hs b/GHC/Event/Thread.hs
index cbef3c3..ca8ed1e 100644
--- a/GHC/Event/Thread.hs
+++ b/GHC/Event/Thread.hs
@@ -103,8 +103,7 @@ closeFdWith close fd = do
(\mgr table -> M.closeFd_ mgr table fd)
mgrs
tables
- close fd
- zipWithM_ finish mgrs tableAndCbApps
+ close fd `finally` zipWithM_ finish mgrs tableAndCbApps
where
finish mgr (table', cbApp) = do
putMVar (M.callbackTableVar mgr fd) table'
More information about the ghc-commits
mailing list