diff options
author | Fredrik Gustafsson <[email protected]> | 2013-03-08 11:26:58 +0100 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-03-08 11:26:58 +0100 |
commit | 02ee25e3cde4e1bec0b3724e28c2831508c98e6f (patch) | |
tree | 64adbb2563731f374f69b0f47440da3e49730940 | |
parent | a9712e121e9bea8906a54b3016cb41ebf1c115f2 (diff) | |
parent | 0792d2102908a1008b08c37e1015ba5e6cb88882 (diff) | |
download | otp-02ee25e3cde4e1bec0b3724e28c2831508c98e6f.tar.gz otp-02ee25e3cde4e1bec0b3724e28c2831508c98e6f.tar.bz2 otp-02ee25e3cde4e1bec0b3724e28c2831508c98e6f.zip |
Merge branch 'ta/docs-16b' into maint
* ta/docs-16b:
Fix gen_fsm example code
Fix doc typos for R16B01
-rw-r--r-- | system/doc/design_principles/fsm.xml | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/system/doc/design_principles/fsm.xml b/system/doc/design_principles/fsm.xml index edb2e20605..7decbb48cd 100644 --- a/system/doc/design_principles/fsm.xml +++ b/system/doc/design_principles/fsm.xml @@ -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}). @@ -87,7 +87,7 @@ locked({button, Digit}, {SoFar, Code}) -> case [Digit|SoFar] of Code -> do_unlock(), - {next_state, open, {[], Code}, 3000}; + {next_state, open, {[], Code}, 30000}; Incomplete when length(Incomplete)<length(Code) -> {next_state, locked, {Incomplete, Code}}; _Wrong -> @@ -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"> @@ -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> @@ -203,7 +204,7 @@ open(timeout, State) -> <section> <title>Timeouts</title> - <p>When a correct code has been givened, the door is unlocked and + <p>When a correct code has been given, the door is unlocked and the following tuple is returned from <c>locked/2</c>:</p> <code type="none"> {next_state, open, {[], Code}, 30000};</code> |