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 reason as an exit signal to pid.

  • # fn is_alive(pid: Pid) -> Bool extern

    Is pid still alive on this node?

  • # fn monitor(pid: Pid) -> Ref extern

    Install a process monitor. Returns the Ref that 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_exit on the caller. Returns the previous value; once enabled, exit signals arrive as regular :EXIT messages.