Monitors
Actors can warn or take actions if their monitored actors or tasks terminate.
Actors.monitor
— Functionmonitor(lk::Link, onsignal...)
monitor(t::Task, onsignal...; timeout::Real=5.0, pollint::Real=0.1)
Start monitoring the actor represented by lk
or the task t
and execute onsignal...
if it sends Down
or if it fails.
Parameters
onsignal...
: action to take onDown
signal:- if empty, it gives a warning;
- if it is one argument
f
, it executes withf(msg.reason)
; - if
f, args...
, it gets executed withf(args..., msg.reason)
.
timeout::Real=5.0
: how many seconds should a task be monitored? After that aDown
with reason:timed_out
is sent.pollint::Real=0.1
: polling interval in seconds for task monitoring.
Actors.demonitor
— Functiondemonitor(lk::Link)
Remove the monitoring for the given link lk
.