[commit: packages/base] master: EventManager: Gracefully handle an initial 'Finished' state (#8235) (d252043)

git at git.haskell.org git at git.haskell.org
Sun Sep 8 21:06:53 CEST 2013


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

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

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

commit d25204344ac356dcc0c587d75f147b7221760c85
Author: Patrick Palka <patrick at parcs.ath.cx>
Date:   Sun Sep 8 12:22:01 2013 -0400

    EventManager: Gracefully handle an initial 'Finished' state (#8235)
    
    Signed-off-by: Andreas Voellmy <andreas.voellmy at gmail.com>


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

d25204344ac356dcc0c587d75f147b7221760c85
 GHC/Event/Manager.hs |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/GHC/Event/Manager.hs b/GHC/Event/Manager.hs
index 8c8858b..5c87d0c 100644
--- a/GHC/Event/Manager.hs
+++ b/GHC/Event/Manager.hs
@@ -248,6 +248,11 @@ loop mgr at EventManager{..} = do
     Created   -> go `onException` cleanup mgr
     Releasing -> go `onException` cleanup mgr
     Dying     -> cleanup mgr
+    -- While a poll loop is never forked when the event manager is in the
+    -- 'Finished' state, its state could read 'Finished' once the new thread
+    -- actually runs.  This is not an error, just an unfortunate race condition
+    -- in Thread.restartPollLoop.  See #8235
+    Finished  -> return ()
     _         -> do cleanup mgr
                     error $ "GHC.Event.Manager.loop: state is already " ++
                             show state





More information about the ghc-commits mailing list