summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Event
diff options
context:
space:
mode:
authorPatrick Palka <patrick@parcs.ath.cx>2013-09-08 12:22:01 -0400
committerAndreas Voellmy <andreas.voellmy@gmail.com>2013-09-08 14:34:25 -0400
commit31132709e277c0885d3e6c28450d3f5593f52a4f (patch)
tree707f1c13f0f92390449be8db70ed47614ce15ebe /libraries/base/GHC/Event
parentacac32c72eef04a53591b5370e75ce325a1748ee (diff)
downloadhaskell-31132709e277c0885d3e6c28450d3f5593f52a4f.tar.gz
EventManager: Gracefully handle an initial 'Finished' state (#8235)
Signed-off-by: Andreas Voellmy <andreas.voellmy@gmail.com>
Diffstat (limited to 'libraries/base/GHC/Event')
-rw-r--r--libraries/base/GHC/Event/Manager.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/libraries/base/GHC/Event/Manager.hs b/libraries/base/GHC/Event/Manager.hs
index 8c8858b079..5c87d0c4f2 100644
--- a/libraries/base/GHC/Event/Manager.hs
+++ b/libraries/base/GHC/Event/Manager.hs
@@ -248,6 +248,11 @@ loop mgr@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