main-apidocs-erlang-estdlib-proc-underscore-lib.md
An implementation of the Erlang/OTP proc_lib interface.
This module implements a strict subset of the Erlang/OTP proc_lib interface.
spawn/1 or spawn_link/1, Erlang/OTP proc_lib sets initial_call to a tuple with a unique atom determining where the function was created, for example {some_module, '-work/3-fun-0-', 0}. AtomVM literaly calls erlang:apply/2 and therefore in these cases, initial_call is {erlang, apply, 2}.exception() = {error | exit | throw, Reason::term()} | {Class::error | exit | throw, Reason::term(), Stacktrace::list()}
start_spawn_option() = {min_heap_size, pos_integer()} | {max_heap_size, pos_integer()} | {atomvm_heap_growth, erlang:atomvm_heap_growth_strategy()} | link
| init_ack/1 | Callback to signal that initialization succeeded. |
| init_ack/2 | Callback to signal that initialization succeeded. |
| init_fail/2 | Equivalent to init_fail(Parent, Return, Exception). |
| init_fail/3 | Signal init failure: nack the starter with Return and raise Exception. |
| initial_call/1 | Get the initial call for a given process or false if it's not available. |
| spawn/1 | Restricted set of spawn options. |
| spawn/3 | Spawn a new process and initialize it. |
| spawn_link/1 | Equivalent to spawn_link(erlang, apply, [Fun, []]). |
| spawn_link/3 | Spawn and atomically link a new process and initialize it. |
| start/3 | Equivalent to start(Module, Function, Args, infinity). |
| start/4 | Equivalent to start(Module, Function, Args, Timeout, []). |
| start/5 | Start a new process synchronously. |
| start_link/3 | Equivalent to start_link(Module, Function, Args, infinity). |
| start_link/4 | Equivalent to start_link(Module, Function, Args, Timeout, []). |
| start_link/5 | Start a new process synchronously and atomically link it. |
| start_monitor/3 | Equivalent to start_monitor(Module, Function, Args, infinity). |
| start_monitor/4 | Equivalent to start_monitor(Module, Function, Args, Timeout, []). |
| start_monitor/5 | Start a new process synchronously and atomically link it. |
| translate_initial_call/1 | Get the initial call for a given process or {proc_lib, init_p, 5} if it's not available. |
init_ack(Result::any()) -> ok
Result: result sent back to parent
Callback to signal that initialization succeeded.
init_ack(Parent::pid(), Result::any()) -> ok
Parent: parent process
Result: result sent back to parent
Callback to signal that initialization succeeded.
init_fail(Return::term(), Exception::exception()) -> no_return()
Equivalent to init_fail(Parent, Return, Exception).
init_fail(Parent::pid(), Return::term(), Exception::exception()) -> no_return()
Signal init failure: nack the starter with Return and raise Exception. Starter blocks until this process is dead, so any registered name is released before the starter sees the failure.
initial_call(Process::pid()) -> {module(), atom(), [atom()]} | false
Process: process to get the initial call for
returns: false until we support process_info(Pid, dictionary)
Get the initial call for a given process or false if it’s not available. Arguments are replaced with atoms.
spawn(Fun::fun(() -> any())) -> pid()
Equivalent to spawn(erlang, apply, [Fun, []]).
Restricted set of spawn options. monitor is not supported.
spawn(Module::module(), Function::atom(), Args::[any()]) -> pid()
Module: of the function to call
Function: to call
Args: arguments to pass to the function
Spawn a new process and initialize it.
spawn_link(Fun::fun(() -> any())) -> pid()
Equivalent to spawn_link(erlang, apply, [Fun, []]).
spawn_link(Module::module(), Function::atom(), Args::[any()]) -> pid()
Module: of the function to call
Function: to call
Args: arguments to pass to the function
Spawn and atomically link a new process and initialize it.
start(Module::module(), Function::atom(), Args::[any()]) -> any()
Equivalent to start(Module, Function, Args, infinity).
start(Module::module(), Function::atom(), Args::[any()], Timeout::timeout()) -> any()
Equivalent to start(Module, Function, Args, Timeout, []).
start(Module::module(), Function::atom(), Args::[any()], Timeout::timeout(), SpawnOpts::[start_spawn_option()]) -> any()
Module: the module in which the callbacks are defined
Function: to call for initialization
Args: arguments to pass to the function
Timeout: timeout for the initialization to be done
SpawnOpts: options passed to spawn. monitor is not allowed.
Start a new process synchronously. Wait for the process to call init_ack/1,2 or init_fail/2,3.
start_link(Module::module(), Function::atom(), Args::[any()]) -> any()
Equivalent to start_link(Module, Function, Args, infinity).
start_link(Module::module(), Function::atom(), Args::[any()], Timeout::timeout()) -> any()
Equivalent to start_link(Module, Function, Args, Timeout, []).
start_link(Module::module(), Function::atom(), Args::[any()], Timeout::timeout(), SpawnOpts::[start_spawn_option()]) -> any()
Module: the module in which the callbacks are defined
Function: to call for initialization
Args: arguments to pass to the function
Timeout: timeout for the initialization to be done
SpawnOpts: options passed to spawn_link. monitor is not allowed.
Start a new process synchronously and atomically link it. Wait for the process to call init_ack/1,2 or init_fail/2,3.
start_monitor(Module::module(), Function::atom(), Args::[any()]) -> any()
Equivalent to start_monitor(Module, Function, Args, infinity).
start_monitor(Module::module(), Function::atom(), Args::[any()], Timeout::timeout()) -> any()
Equivalent to start_monitor(Module, Function, Args, Timeout, []).
start_monitor(Module::module(), Function::atom(), Args::[any()], Timeout::timeout(), SpawnOpts::[start_spawn_option()]) -> any()
Module: the module in which the callbacks are defined
Function: to call for initialization
Args: arguments to pass to the function
Timeout: timeout for the initialization to be done
SpawnOpts: options passed to spawn_link. monitor is not allowed.
Start a new process synchronously and atomically link it. Wait for the process to call init_ack/1,2 or init_fail/2,3.
translate_initial_call(Process::pid()) -> {module(), atom(), non_neg_integer()}
Process: process to get the initial call for
returns: {proc_lib, init_p, 5} until we support process_info(Pid, dictionary)
Get the initial call for a given process or {proc_lib, init_p, 5} if it’s not available.