#4154: Deadlock in Chan module
---------------------------------+------------------------------------------
Reporter: NeilMitchell | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries/base
Version: 6.12.3 | Keywords:
Os: Windows | Testcase:
Architecture: Unknown/Multiple | Failure: Incorrect result at runtime
---------------------------------+------------------------------------------
The following program:
{{{
module Main where
import Control.Concurrent
main :: IO ()
main = do
todo <- newChan
forkIO $ readChan todo
putStrLn "Before isEmptyChan"
b <- isEmptyChan todo
putStrLn "After isEmptyChan"
writeChan todo ()
}}}
Gives the output:
{{{
$ ghc --make Main.hs -threaded && ./Main.exe
Before isEmptyChan
Main.exe: thread blocked indefinitely in an MVar operation
}}}
I think that's a bug. Note that if the {{{putStrLn}}} statements are
removed then it works, but I think that's because the printing introduces
a delay that lets the other thread run.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4154>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs