diff options
author | Niclas Axelsson <[email protected]> | 2011-03-09 17:29:54 +0100 |
---|---|---|
committer | Niclas Axelsson <[email protected]> | 2011-03-09 17:34:01 +0100 |
commit | 4668c233c8f850eb5c3e04e760b25d34b73aa497 (patch) | |
tree | 137e2bb3954b3976c328a286f94a926ad526cea2 /system | |
parent | 3ad2818405636fcf8b0d7b50ce5d7add83578738 (diff) | |
parent | 1fb616dac50969cef3f260ec9d899f2f980fca1d (diff) | |
download | otp-4668c233c8f850eb5c3e04e760b25d34b73aa497.tar.gz otp-4668c233c8f850eb5c3e04e760b25d34b73aa497.tar.bz2 otp-4668c233c8f850eb5c3e04e760b25d34b73aa497.zip |
Merge branch 'gl/gen_server-doc' into dev
* gl/gen_server-doc:
Update Handling Other Messages section in gen_server, gen_fsm, gen_events overviews
OTP-9121
Diffstat (limited to 'system')
-rw-r--r-- | system/doc/design_principles/events.xml | 17 | ||||
-rw-r--r-- | system/doc/design_principles/fsm.xml | 5 | ||||
-rw-r--r-- | system/doc/design_principles/gen_server_concepts.xml | 5 |
3 files changed, 27 insertions, 0 deletions
diff --git a/system/doc/design_principles/events.xml b/system/doc/design_principles/events.xml index 5579f1e459..fab9e8305e 100644 --- a/system/doc/design_principles/events.xml +++ b/system/doc/design_principles/events.xml @@ -217,5 +217,22 @@ terminate(_Args, Fd) -> ok</pre> </section> </section> + <section> + <title>Handling Other Messages</title> + <p>If the gen_event should be able to receive other messages than + events, the callback function <c>handle_info(Info, StateName, StateData)</c> + must be implemented to handle them. Examples of + other messages are exit messages, if the gen_event is linked to + other processes (than the supervisor) and trapping exit signals.</p> + <code type="none"> +handle_info({'EXIT', Pid, Reason}, State) -> + ..code to handle exits here.. + {ok, NewState}.</code> + <p>The code_change method also has to be implemented.</p> + <code type="none"> +code_change(OldVsn, State, Extra) -> + ..code to convert state (and more) during code change + {ok, NewState}</code> + </section> </chapter> diff --git a/system/doc/design_principles/fsm.xml b/system/doc/design_principles/fsm.xml index 7cdd62057b..c3e9027274 100644 --- a/system/doc/design_principles/fsm.xml +++ b/system/doc/design_principles/fsm.xml @@ -308,6 +308,11 @@ terminate(normal, _StateName, _StateData) -> handle_info({'EXIT', Pid, Reason}, StateName, StateData) -> ..code to handle exits here.. {next_state, StateName1, StateData1}.</code> + <p>The code_change method also has to be implemented.</p> + <code type="none"> +code_change(OldVsn, StateName, StateData, Extra) -> + ..code to convert state (and more) during code change + {ok, NextStateName, NewStateData}</code> </section> </chapter> diff --git a/system/doc/design_principles/gen_server_concepts.xml b/system/doc/design_principles/gen_server_concepts.xml index 8131c47a69..231333da0e 100644 --- a/system/doc/design_principles/gen_server_concepts.xml +++ b/system/doc/design_principles/gen_server_concepts.xml @@ -264,6 +264,11 @@ terminate(normal, State) -> handle_info({'EXIT', Pid, Reason}, State) -> ..code to handle exits here.. {noreply, State1}.</code> + <p>The code_change method also has to be implemented.</p> + <code type="none"> +code_change(OldVsn, State, Extra) -> + ..code to convert state (and more) during code change + {ok, NewState}.</code> </section> </chapter> |