hpath/unix/tests/signals002.hs

16 lines
462 B
Haskell
Raw Normal View History

2020-04-14 09:27:28 +00:00
import System.Posix
import Control.Concurrent
-- !!! test blockSignals, raiseSignal, unblockSignals, getPendingSignals
main = do
blockSignals ( userDefinedSignal1 `addSignal` emptySignalSet )
raiseSignal userDefinedSignal1
set <- getPendingSignals
print (userDefinedSignal1 `inSignalSet` set)
m <- newEmptyMVar
installHandler userDefinedSignal1
(Catch (putStrLn "hello" >> putMVar m ())) Nothing
awaitSignal (Just emptySignalSet)
takeMVar m