GenServers
Callbacks
The callback functions are part of an implementation module and are called by the :genserver
actor on startup or on cast and call requests:
GenServers.init
— Functioninit(default...)
This callback function is called on startup by a :genserver
actor. It gets the default...
argument provided with the genserver
start function.
Its return value is saved in the :genserver
actor's state variable and then served to subsequent call
and cast
callbacks.
GenServers.oncast
— Functiononcast(default..., msg...)
This callback function is executed on the default...
state variable with msg...
message arguments from a cast
request. This can be used to modify the default...
state variable(s).
GenServers.oncall
— Functiononcall(default..., msg...)
This callback function is executed on the default...
state variable with msg...
message arguments from a call
request. This can be used to modify the default...
state variable(s). Its return value is sent back to the caller.