[commit: base] : Tidy up GHC.Event.Thread.closeFdWith. (392b727)

Johan Tibell johan.tibell at gmail.com
Tue Feb 12 07:51:24 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : 

http://hackage.haskell.org/trac/ghc/changeset/392b727fa742fae70bbca7d6d562b10bd1781b87

>---------------------------------------------------------------

commit 392b727fa742fae70bbca7d6d562b10bd1781b87
Author: Andreas Voellmy <andreas.voellmy at gmail.com>
Date:   Fri Jan 4 10:01:02 2013 -0500

    Tidy up GHC.Event.Thread.closeFdWith.

>---------------------------------------------------------------

 GHC/Event/Thread.hs |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/GHC/Event/Thread.hs b/GHC/Event/Thread.hs
index 915b5f3..578e591 100644
--- a/GHC/Event/Thread.hs
+++ b/GHC/Event/Thread.hs
@@ -95,19 +95,19 @@ closeFdWith :: (Fd -> IO ())        -- ^ Action that performs the close.
 closeFdWith close fd = do
   eventManagerArray <- readIORef eventManager
   let (low, high) = boundsIOArray eventManagerArray
-  tableVars <- forM [low..high] $ \i -> do
+  mgrs <- forM [low..high] $ \i -> do
     Just (_,!mgr) <- readIOArray eventManagerArray i
-    return (mgr, M.callbackTableVar mgr fd)
+    return mgr
   mask_ $ do
-    tables <- forM tableVars (takeMVar.snd)
+    tables <- forM mgrs $ \mgr -> takeMVar $ M.callbackTableVar mgr fd
     tables' <- zipWithM
-               (\(mgr,tableVar) table -> M.closeFd_ mgr table fd)
-               tableVars
+               (\mgr table -> M.closeFd_ mgr table fd)
+               mgrs
                tables
     close fd
     zipWithM_
-      (\(mgr,tableVar) table' -> putMVar tableVar table')
-      tableVars
+      (\mgr table' -> putMVar (M.callbackTableVar mgr fd) table')
+      mgrs
       tables'
 
 threadWait :: Event -> Fd -> IO ()





More information about the ghc-commits mailing list