Std.Supervisor
View source →Start, stop, and introspect Cure supervisor trees.
Each Cure sup container compiles to a loaded BEAM module that
implements the :supervisor behaviour. The functions below
delegate to Cure.Sup.Runtime, which wraps :supervisor with
a tiny ETS registry so a tree can be reached by its compiled
module atom without threading pids through user code.
Examples
use Std.Supervisor
start(:"Cure.Sup.MyRoot")
which_children(:"Cure.Sup.MyRoot")
stop(:"Cure.Sup.MyRoot")
Functions
-
# fn __group__() -> Atom
Group tag consumed by
Cure.Stdlib.Preload. -
# fn count_children(sup_module: Atom) -> Map(Any, Any) extern
Count children grouped by type, as
%{type => count}. -
# fn list() -> List(Atom) extern
List every supervisor tree the runtime is currently tracking.
-
# fn lookup(sup_module: Atom) -> Pid extern
Look up a running supervisor's pid by its compiled module atom. Returns
nilwhen no such tree is running. -
# fn start(sup_module: Atom) -> Pid extern
Start a compiled Cure supervisor module. Returns the top-level supervisor pid on success.
-
# fn start_with(sup_module: Atom, init: Any) -> Pid extern
Start a compiled Cure supervisor with an explicit initial argument that is threaded into its
init/1callback. -
# fn stop(sup_module: Atom) -> Atom extern
Stop a running supervisor tree.
-
# fn which_children(sup_module: Atom) -> List(Tuple) extern
Return the list of
%[id, child_pid, type, modules]tuples for the supervisor's direct children.