BlockedIndefinitely not thrown when it should be
The following program demonstrates the bug. When run with no arguments, the "die" thread gets a BlockedIndefinitely exception, when run with command line arguments it does not.
module Main where
import Control.Monad
import Control.Concurrent
import Control.Concurrent.STM
import System.Environment
main :: IO ()
main = do { flags <- getArgs
; if (length flags > 0)
then forkIO die >> -- die does not die
threadDelay 10000000
else die -- die dies
}
-- expect BlockedIndefinitely exception to be thrown
die :: IO ()
die = newTVarIO "die" >>= f >>= print
where f tv = atomically $ do { x <- readTVar tv
; if x == "die" then retry else return x
}
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Runtime System |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | MacOS X |
Architecture | x86 |