summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/concurrent/should_run/conc069a.hs
blob: 5bf619bec126063ddc81ac69a5639d6fc2d0af6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import Control.Concurrent
import Control.Exception

main = do
  -- stat -- main thread is not bound in GHCi
  m <- newEmptyMVar
  forkIO (do stat; putMVar m ())
  takeMVar m
  mask_ $ forkIO (do stat; putMVar m ())
  takeMVar m
  forkOS (do stat; putMVar m ())
  takeMVar m
  mask_ $ forkOS (do stat; putMVar m ())
  takeMVar m

stat = do
  x <- isCurrentThreadBound
  y <- getMaskingState
  print (x,y)