Std.Process
View source →Raw process primitives: links, monitors, trap_exit.
These wrappers call :erlang BIFs directly via @extern; they
do not go through the actor runtime, so they work on any BEAM
process (actors, FSMs, or plain spawn/1 results).
The monitor reference returned by monitor/1 uses the Ref
primitive type introduced for typed concurrency; see
docs/TYPE_SYSTEM.md.
Examples
use Std.Process
let me = self()
is_alive(me) # => true
use Std.Process
# Monitor a child and wait for its down message.
let child = Std.Actor.spawn(:"Cure.Actor.Echo")
let ref = monitor(child)
trap_exit(true)
Functions
-
# fn __group__() -> Atom
Group tag consumed by
Cure.Stdlib.Preload. -
# fn demonitor(ref: Ref) -> Bool extern
Remove a previously installed monitor.
-
# fn exit(pid: Pid, reason: Atom) -> Atom extern
Send
reasonas an exit signal topid. -
# fn is_alive(pid: Pid) -> Bool extern
Is
pidstill alive on this node? -
# fn link(pid: Pid) -> Atom extern
Link the calling process to
pid. Exits from either side propagate as:EXITmessages. -
# fn monitor(pid: Pid) -> Ref extern
Install a process monitor. Returns the
Refthat identifies the monitor; the caller will later receive{:DOWN, ref, :process, pid, reason}when the monitored process terminates. -
# fn self() -> Pid extern
Return the caller's own pid.
-
# fn trap_exit(flag: Bool) -> Bool extern
Toggle
trap_exiton the caller. Returns the previous value; once enabled, exit signals arrive as regular:EXITmessages. -
# fn unlink(pid: Pid) -> Atom extern
Undo a previous
link/1.