blob: fd757133a55aa0bd388dafd6caefa593c0844580 (
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
block $ forkIO (do stat; putMVar m ())
takeMVar m
forkOS (do stat; putMVar m ())
takeMVar m
block $ forkOS (do stat; putMVar m ())
takeMVar m
stat = do
x <- isCurrentThreadBound
y <- blocked
print (x,y)
|