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 ()
当前内容版权归 hamler-lang 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 hamler-lang .