Ticket #2858: Test.hs

File Test.hs, 365 bytes (added by dsh, 6 years ago)

Test with installHandler

Line 
1module Main (main) where
2
3import Control.Concurrent (forkOS, threadDelay)
4import System.Posix.Signals
5
6infinistr s = putStrLn s >> threadDelay 10
7infinistr_ s = putStrLn s >> infinistr_ s
8
9handler = do
10  forkOS (infinistr "child")
11  installHandler sigTERM Default Nothing
12  return ()
13
14main = do
15  installHandler sigTERM (Catch handler) Nothing
16  infinistr_ "main"
17