3. gen_fsm Behaviour

3 gen_fsm Behaviour

Note

There is a new behaviour gen_statem that is intended to replace gen_fsm for new code. It has the same features and add some really useful. This module will not be removed for the foreseeable future to keep old state machine implementations running.

This section is to be read with the gen_fsm(3) manual page in STDLIB, where all interface functions and callback functions are described in detail.

3.1 Finite-State Machines

A Finite-State Machine (FSM) can be described as a set of relations of the form:

State(S) x Event(E) -> Actions(A), State(S')

These relations are interpreted as meaning:

If we are in state 登录查看完整内容