[commit: packages/base] master: Fix off-by-one error in the IO manager (3cb2d58)

git at git.haskell.org git at git.haskell.org
Mon Sep 2 18:29:24 CEST 2013


Repository : ssh://git@git.haskell.org/base

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3cb2d582fef3f79d1f21cf7bd984a7477c58e9e4/base

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

commit 3cb2d582fef3f79d1f21cf7bd984a7477c58e9e4
Author: Patrick Palka <patrick at parcs.ath.cx>
Date:   Sun Sep 1 17:34:31 2013 -0400

    Fix off-by-one error in the IO manager
    
    The last enabled event manager was being needlessly restarted after
    increasing the number of capabilities at runtime.


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

3cb2d582fef3f79d1f21cf7bd984a7477c58e9e4
 GHC/Event/Thread.hs |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/GHC/Event/Thread.hs b/GHC/Event/Thread.hs
index c4f83a0..61abbd0 100644
--- a/GHC/Event/Thread.hs
+++ b/GHC/Event/Thread.hs
@@ -332,7 +332,7 @@ ioManagerCapabilitiesChanged = do
               -- copy the existing values into the new array:
               forM_ [0..high] $ \i -> do
                 Just (tid,mgr) <- readIOArray eventManagerArray i
-                if i < numEnabled - 1
+                if i < numEnabled
                   then writeIOArray new_eventManagerArray i (Just (tid,mgr))
                   else do tid' <- restartPollLoop mgr i
                           writeIOArray new_eventManagerArray i (Just (tid',mgr))





More information about the ghc-commits mailing list