summaryrefslogtreecommitdiff
path: root/testsuite/tests/concurrent/should_run/conc066.hs
blob: 0f3a699b03f9678c6a1402bce7ec33c3130cfeb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
-- Test for bug #1047

import Control.Concurrent
import Control.Exception

-- This loop spends most of its time printing stuff, and very occasionally
-- executes 'unblock (return ())'.  This test ensures that a thread waiting
-- to throwTo this thread is not blocked indefinitely.
loop restore = do restore (return ()); print "alive"; loop restore

main = do tid <- forkIO (mask $ \restore -> loop restore)
          yield
          killThread tid