Ticket #2651 (closed bug: wontfix)
BlockedIndefinitely not thrown when it should be
| Reported by: | govereau | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.10 branch |
| Component: | Runtime System | Version: | 6.8.3 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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
}
Change History
Note: See
TracTickets for help on using
tickets.
