summaryrefslogtreecommitdiff
path: root/testsuite/tests/concurrent/should_run/readMVar2.hs
blob: 7d6eb5c1f533ca1c5814b7ad85a08508907c9a07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
module Main where

import Control.Concurrent

main = do
    m <- newEmptyMVar
    sync <- newEmptyMVar
    let f = readMVar m
    t1 <- forkIO (f >> error "FAILURE")
    t2 <- forkIO (f >> putMVar sync ())
    killThread t1
    putMVar m (0 :: Int)
    readMVar sync