Module gen

Data Types

emgr_name()


emgr_name() = {local, atom()}

linkage()


linkage() = link | nolink | monitor

server_ref()


server_ref() = atom() | pid()

Function Index

call/4 Perform a call on a gen server.
start/5 Start a gen_* process without a registered name.
start/6 Start a gen_* process with a registered name, as called by Elixir (:gen.start(:gen_server, Link, {local, Name}, Module, Args, Options)).

Function Details

call/4


call(ServerRef::server_ref(), Label::atom(), Request::term(), Timeout::timeout()) -> {ok, Reply::term()} | {error, Reason::term()}

ServerRef: the server to call
Label: the label for the message, typically system or $gen_call
Request: the message to send
Timeout: timeout for sending the message

returns: {ok, Result} or raises an exit exception

Perform a call on a gen server. This API not documented by OTP, yet Elixir uses it, so this function matches the current OTP-28 behavior.

start/5


start(GenMod::module(), LinkP::linkage(), Module::module(), Args::term(), Options::list()) -> {ok, pid()} | {ok, {pid(), reference()}} | ignore | {error, term()}

Start a gen_* process without a registered name. This is the OTP-private entry point Elixir’s GenServer.start_link/start calls (:gen.start(:gen_server, Link, Module, Args, Options)). It bridges to the AtomVM gen_* module’s init_it protocol via proc_lib.

start/6


start(GenMod::module(), LinkP::linkage(), Name::emgr_name(), Module::module(), Args::term(), Options::list()) -> {ok, pid()} | {ok, {pid(), reference()}} | ignore | {error, term()}

Start a gen_* process with a registered name, as called by Elixir (:gen.start(:gen_server, Link, {local, Name}, Module, Args, Options)).

Only {local, Name} is supported.