Skip to content

Commit

Permalink
Fix gen_fsm example code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuncer Ayaz committed Mar 7, 2013
1 parent 9e4a37c commit 0792d21
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions system/doc/design_principles/fsm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ StateName(Event, StateData) ->
-export([init/1, locked/2, open/2]).
start_link(Code) ->
gen_fsm:start_link({local, code_lock}, code_lock, Code, []).
gen_fsm:start_link({local, code_lock}, code_lock, lists:reverse(Code, []).
button(Digit) ->
gen_fsm:send_event(code_lock, {button, Digit}).
Expand Down Expand Up @@ -106,7 +106,8 @@ open(timeout, State) ->
calling <c>code_lock:start_link(Code)</c>:</p>
<code type="none">
start_link(Code) ->
gen_fsm:start_link({local, code_lock}, code_lock, Code, []).</code>
gen_fsm:start_link({local, code_lock}, code_lock, lists:reverse(Code), []).
</code>
<p><c>start_link</c> calls the function <c>gen_fsm:start_link/4</c>.
This function spawns and links to a new process, a gen_fsm.</p>
<list type="bulleted">
Expand All @@ -130,8 +131,8 @@ start_link(Code) ->
corresponding to one process contained in one module.</p>
</item>
<item>
<p>The third argument, <c>Code</c>, is a term which is passed
as-is to the callback function <c>init</c>. Here, <c>init</c>
<p>The third argument, <c>Code</c>, is a list of digits which is passed
reversed to the callback function <c>init</c>. Here, <c>init</c>
gets the correct code for the lock as indata.</p>
</item>
<item>
Expand Down

0 comments on commit 0792d21

Please sign in to comment.