
[Redirecting to GHC users] A crash is bad, and the HEAD reports an error in a civilised way. It is indeed illegal to use atomically inside an unsafePerformIO. I've also committed a fix to the documentation of atomically to mention this point. In general, the documentation of STM is very thin -- we would welcome someone to improve it. Simon | -----Original Message----- | From: haskell-bounces@haskell.org [mailto:haskell-bounces@haskell.org] On Behalf Of Johannes Goetz | Sent: 12 July 2006 04:50 | To: Haskell Mailing List | Subject: [Haskell] crash unsafeperformio stm | | hi folks, | | i'm using ghc6 (apt-get install ghc6) on debian31. as far is i | understand, the following program shouldn't crash. can somebody tell me | why it does? thanks a lot. johannes. | | module Main(main) where | | import Control.Concurrent.STM | import System.IO.Unsafe | | {-# NOINLINE a #-} | a :: TMVar Int | a = unsafePerformIO $ atomically $ newTMVar 123 | | main = do | atomically $ takeTMVar a >>= putTMVar a | | ghc --make -fno-cse Test.hs -o test | ./test | Segmentation fault | | _______________________________________________ | Haskell mailing list | Haskell@haskell.org | http://www.haskell.org/mailman/listinfo/haskell