Monitoring
Monitoring
One process Pid1 can monitor another process Pid2. If Pid2 terminates, Pid1 will receive a ‘DOWN’ message from Pid2.
import Prelude
import Control.Process (killProc)
go :: forall a. IO a
go = do
pid <- spawn proc
ref <- monitor pid
killProc pid
receive msg -> return msg
proc :: Process ()
proc = receive _ -> return ()
