Ticket #396: bug2.2.hs

File bug2.2.hs, 393 bytes (added by volkersf, 10 years ago)
Line 
1module Main where
2
3import Control.Concurrent
4import GHC.IOBase
5
6{-# NOINLINE mv #-}
7mv :: MVar a
8mv = unsafePerformIO $ newEmptyMVar
9
10main = do
11  putMVar mv "foo"
12  t1 <- takeMVar mv
13  print (t1::String)
14  -- comment out to get "threads blocked indefinetely" instead:
15  putMVar mv t1      -- (1)
16  print "here"
17  -- putMVar mv 3    -- (2)
18  print "there"
19  t2 <- takeMVar mv
20  print (t2::Int)