Commit 449b0be4 authored by Simon Marlow's avatar Simon Marlow
Browse files

Fix deadlock on second call to newSession

Tracked down by Krasimir Angelov
parent eea8fd53
......@@ -333,7 +333,7 @@ newSession :: GhcMode -> Maybe FilePath -> IO Session
newSession mode mb_top_dir = do
-- catch ^C
main_thread <- myThreadId
putMVar interruptTargetThread [main_thread]
modifyMVar_ interruptTargetThread (return . (main_thread :))
installSignalHandlers
dflags0 <- initSysTools mb_top_dir defaultDynFlags
......
......@@ -40,7 +40,7 @@ import GHC.ConsoleHandler
#endif
import Control.Exception hiding (try)
import Control.Concurrent ( myThreadId, MVar, ThreadId, withMVar, newEmptyMVar )
import Control.Concurrent ( myThreadId, MVar, ThreadId, withMVar, newMVar )
import Data.Dynamic
import qualified Control.Exception as Exception
import Debug.Trace ( trace )
......@@ -237,5 +237,5 @@ installSignalHandlers = do
{-# NOINLINE interruptTargetThread #-}
interruptTargetThread :: MVar [ThreadId]
interruptTargetThread = unsafePerformIO newEmptyMVar
interruptTargetThread = unsafePerformIO (newMVar [])
\end{code}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment