There is a new behaviour
This behavior module provides a finite state machine.
A generic finite state machine process (
A
gen_fsm module Callback module -------------- --------------- gen_fsm:start gen_fsm:start_link -----> Module:init/1 gen_fsm:stop -----> Module:terminate/3 gen_fsm:send_event -----> Module:StateName/2 gen_fsm:send_all_state_event -----> Module:handle_event/3 gen_fsm:sync_send_event -----> Module:StateName/3 gen_fsm:sync_send_all_state_event -----> Module:handle_sync_event/4 - -----> Module:handle_info/3 - -----> Module:terminate/3 - -----> Module:code_change/4
If a callback function fails or returns a bad value, the
A
Notice that a
Unless otherwise stated, all functions in this module fail if
the specified
The
Cancels an internal timer referred by
If the timer has already timed out, but the event not yet been delivered, it is cancelled as if it had not timed out, so there is no false timer event after returning from this function.
Returns the remaining time in milliseconds until the timer would
have expired if
Makes an existing process into a
This function is useful when a more complex initialization
procedure is needed than the
The function fails if the calling process was not started by a
This function can be used by a
Return value
Sends an event asynchronously to the
For a description of the arguments, see
The difference between
Sends an event asynchronously to the
Sends a delayed event internally in the
The
Creates a standalone
For a description of arguments and return values, see
Creates a
The
If
If
If
If no name is provided, the
If option
If option
If option
Using spawn option
If the
If
Sends a time-out event internally in the
The
Orders a generic finite state machine to exit with the specified
The function returns
If the process does not exist, a
Sends an event to the
For a description of
For a discussion about the difference between
Sends an event to the
For a description of
Return value
The following functions are to be exported from a
state name denotes a state of the state machine.
state data denotes the internal state of the Erlang process that implements the state machine.
This function is called by a
For an upgrade,
The function is to return the new current state name and updated internal data.
This callback is optional, so callback modules need not
export it. The
This function is called by a
This function is useful for changing the form and
appearance of the
The function is to return
One use for this function is to return compact alternative state data representations to avoid that large state terms are printed in log files.
Whenever a
For a description of the other arguments and possible return values,
see
This function is called by a
For a description of the other arguments and possible return values,
see
Whenever a
For a description of the other arguments and possible return values,
see
Whenever a
If initialization is successful, the function is to return
If an integer time-out value is provided, a time-out occurs
unless an event or a message is received within
If
If the initialization fails, the function returns
There is to be one instance of this function for each
possible state name. Whenever a
If the function returns
If the function returns
There is to be one instance of this function for each
possible state name. Whenever a
If
If
If the function returns
This function is called by a
If the
The
The shutdown strategy as defined in the child specification of
the supervisor is an integer time-out value, not
Even if the
Otherwise, the
Notice that for any other reason than