
#4001: Implement an atomic readMVar ----------------------------+---------------------------------------------- Reporter: | Owner: ezyang simonmar | Status: new Type: task | Milestone: 7.6.2 Priority: low | Version: 6.12.2 Component: Runtime | Keywords: System | Architecture: Unknown/Multiple Resolution: | Difficulty: Moderate (less than a day) Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | ----------------------------+---------------------------------------------- Comment (by ezyang): While testing, I discovered this program spins infinitely when run through ghci (all the compiled ways are fine): {{{ module Main where import GHC.MVar import Control.Concurrent main = do m <- newEmptyMVar sync <- newEmptyMVar let f = atomicReadMVar m t1 <- forkIO (f >> error "FAILURE") t2 <- forkIO (f >> putMVar sync ()) killThread t1 putMVar m (0 :: Int) atomicReadMVar sync }}} Does ghci have any sort of special MVar handling? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/4001#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler