#2651: BlockedIndefinitely not thrown when it should be
------------------------------+---------------------------------------------
 Reporter:  govereau          |          Owner:                  
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Milestone:  6.10 branch     
Component:  Runtime System    |        Version:  6.8.3           
 Severity:  normal            |     Resolution:                  
 Keywords:                    |     Difficulty:  Unknown         
 Testcase:                    |   Architecture:  Unknown/Multiple
       Os:  Unknown/Multiple  |  
------------------------------+---------------------------------------------
Changes (by igloo):

  * difficulty:  => Unknown
  * os:  MacOS X => Unknown/Multiple
  * architecture:  x86 => Unknown/Multiple
  * milestone:  => 6.10 branch

Comment:

 Here's an example that doesn't need stm:
 {{{
 module Main where
 import Control.Concurrent
 import Control.Concurrent.MVar
 import Control.Exception as E
 import System.Environment

 main :: IO ()
 main = do flags <- getArgs
           if (length flags > 0)
               then do forkIO die
                       threadDelay 10000000
               else die

 -- expect BlockedIndefinitely exception to be thrown
 die :: IO ()
 die = newEmptyMVar >>= g
  where g v = f v `E.catch` \e -> do print ('a', e :: E.SomeException)
                                     E.throw e
        f v = readMVar v
 }}}

 {{{
 $ ghc n.hs -o n -fforce-recomp
 $ ./n
 ('a',thread blocked indefinitely)
 n: thread blocked indefinitely
 $ ./n q
 $
 }}}
 The thread does get an exception with the threaded RTS, however:
 {{{
 $ ghc n.hs -o n -fforce-recomp -threaded
 $ ./n
 ('a',thread blocked indefinitely)
 n: thread blocked indefinitely
 $ ./n q
 ('a',thread blocked indefinitely)
 $
 }}}
 (the above is with the 6.10 branch)

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