summaryrefslogtreecommitdiff
path: root/testsuite/tests/concurrent/should_run/conc058.hs
blob: 5fbe4e5af8e0984554687157d828bf16dcfd3000 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import Control.Concurrent
import Control.Exception

-- variation on conc020 that tests for threadDelay being interruptible.
-- On Windows, with the threaded RTS, in 6.6 and earlier, threadDelay is 
-- not interruptible.
main = do
  m <- newEmptyMVar
  t <- forkIO (block $ threadDelay 1000000)
  threadDelay 100000
  throwTo t (ErrorCall "I'm Interruptible")
  threadDelay 100000
  putMVar m ()  -- to avoid t being garbage collected