summaryrefslogtreecommitdiff
path: root/testsuite/tests/concurrent/should_run/conc066.hs
blob: 81638dfd10c2b3f302ae85a1867d73be435860d6 (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 = do unblock (return ()); print "alive"; loop

main = do tid <- forkIO (block loop)
          yield
          killThread tid