#2651: BlockedIndefinitely not thrown when it should be
-------------------------+--------------------------------------------------
    Reporter:  govereau  |       Owner:                
        Type:  bug       |      Status:  new           
    Priority:  normal    |   Component:  Runtime System
     Version:  6.8.3     |    Severity:  normal        
    Keywords:            |    Testcase:                
Architecture:  x86       |          Os:  MacOS X       
-------------------------+--------------------------------------------------
 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
                               }
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2651>
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

Reply via email to