diff options
Diffstat (limited to 'testsuite/tests/concurrent/should_run/conc070.hs')
-rw-r--r-- | testsuite/tests/concurrent/should_run/conc070.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/concurrent/should_run/conc070.hs b/testsuite/tests/concurrent/should_run/conc070.hs new file mode 100644 index 0000000000..71eb415427 --- /dev/null +++ b/testsuite/tests/concurrent/should_run/conc070.hs @@ -0,0 +1,18 @@ +import Control.Concurrent +import GHC.Conc +import Data.List +import Data.Maybe + +main = do + t1 <- forkIO (threadDelay 100000000) + m <- newEmptyMVar + t2 <- forkIO (takeMVar m) + t3 <- forkIO (let loop = do r <- tryTakeMVar m; + _ <- newEmptyMVar -- do some allocation :( + if isNothing r then loop else return () + in loop) + t4 <- forkIO (return ()) + yield + threadDelay 10000 + print =<< mapM threadStatus [t1,t2,t3,t4] + putMVar m () |