testsuite/T9379: Use GHC.Conc instead of Control.Concurrent.STM
[ghc.git] / testsuite / tests / concurrent / should_run / T9379.hs
1 import Control.Exception
2 import Control.Concurrent
3 import GHC.Conc
4 import Foreign.StablePtr
5
6 main :: IO ()
7 main = do
8 tv <- atomically $ newTVar True
9 _ <- newStablePtr tv
10 t <- mask_ $ forkIO (blockSTM tv)
11 killThread t
12
13 check b = if b then return () else retry
14
15 blockSTM :: TVar Bool -> IO ()
16 blockSTM tv = do
17 atomically $ do
18 v <- readTVar tv
19 check $ not v