Ticket #4154 (closed bug: fixed)
Deadlock in Chan module
| Reported by: | NeilMitchell | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | 7.0.1 |
| Component: | libraries/base | Version: | 6.12.3 |
| Keywords: | Cc: | ndmitchell@…, mmitar@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Incorrect result at runtime | Difficulty: | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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.
Change History
Note: See
TracTickets for help on using
tickets.
