gen_fsm v0.1.0 GenFSM behaviour
Summary
Types
Debug options supported by the start*
functions
The fsm reference
The GenFSM name
Return values of start*
functions
Option values used by the start*
functions
Options used by the start*
functions
Functions
Cancels an internal timer referred by reference
in the GenFSM
that calls this function
This function can be used by a GenFSM
to explicitly send a
reply to a client process
Sends an event asynchronously to the GenFSM
and returns
:ok
immediately
Sends a delayed event internally in the GenFSM
that calls this
function after time
in ms. Returns immediately a reference
that
can be used to cancel the delayed send using cancel_timer/1
Sends a timeout event internally in the GenFSM
that calls this
function after time
set in ms. Returns immediately a reference
that can be used to cancel the timer using cancel_timer/1
Sends an event to the GenFSM
and waits until a reply arrives
or a timeout
occurs
Sends an event
to the GenFSM
and waits until a reply arrives
or a timeout occurs
Types
debug :: [:trace | :log | :statistics | {:log_to_file, Path.t} | {:install, {(... -> any), any}}]
Debug options supported by the start*
functions
event :: term
from :: {pid, tag :: term}
name ::
atom |
{:global, term} |
{:via, module, term}
The GenFSM name
new_state_data :: term
next_state_name :: atom
on_start ::
{:ok, pid} |
:ignore |
{:error, {:already_started, pid} | term}
Return values of start*
functions
option ::
{:debug, debug} |
{:name, name} |
{:timeout, timeout} |
{:spawn_opt, Process.spawn_opt}
Option values used by the start*
functions
reason :: term
remaining_time :: integer
reply :: term
state_data :: term
state_name :: atom
Functions
Specs
cancel_timer(reference) :: remaining_time | false
Cancels an internal timer referred by reference
in the GenFSM
that calls this function.
This function can be used by a GenFSM
to explicitly send a
reply to a client process.
Sends an event asynchronously to the GenFSM
and returns
:ok
immediately.
Specs
send_event_after(integer, event) :: reference
Sends a delayed event internally in the GenFSM
that calls this
function after time
in ms. Returns immediately a reference
that
can be used to cancel the delayed send using cancel_timer/1
.
Specs
start_timer(integer, term) :: reference
Sends a timeout event internally in the GenFSM
that calls this
function after time
set in ms. Returns immediately a reference
that can be used to cancel the timer using cancel_timer/1
.
Specs
stop(fsm_ref, reason :: term, timeout) :: :ok
Sends an event to the GenFSM
and waits until a reply arrives
or a timeout
occurs.
Callbacks
Specs
code_change(old_vsn, state_name, state_data, extra :: term) ::
{:ok, next_state_name, new_state_data} |
{:error, reason} when old_vsn: term | {:down, term}
Specs
handle_event(event :: term, state_name, state_data) ::
{:next_state, next_state_name, new_state_data} |
{:next_state, next_state_name, new_state_data, timeout} |
{:next_state, next_state_name, new_state_data, :hibernate} |
{:stop, reason, new_state_data} when new_state_data: term
Specs
handle_info(info :: term, state_name, state_data) ::
{:next_state, next_state_name, new_state_data} |
{:next_state, next_state_name, new_state_data, timeout} |
{:next_state, next_state_name, new_state_data, :hibernate} |
{:stop, reason, new_state_data} when new_state_data: term
Specs
handle_sync_event(event :: term, from :: {pid, tag :: term}, state_name, state_data) ::
{:reply, reply, next_state_name, new_state_data} |
{:reply, reply, next_state_name, new_state_data, timeout} |
{:reply, reply, next_state_name, new_state_data, :hibernate} |
{:next_state, next_state_name, new_state_data} |
{:next_state, next_state_name, new_state_data, timeout} |
{:next_state, next_state_name, new_state_data, :hibernate} |
{:stop, reason, reply, new_state_data} |
{:stop, reason, new_state_data} when new_state_data: term
Specs
init(args :: term) ::
{:ok, state_name, state_data} |
{:ok, state_name, state_data, timeout | :hibernate} |
:ignore |
{:stop, reason}
Specs
terminate(reason, state_name, state_data) :: term when reason: :normal | :shutdown | {:shutdown, term} | term