aboutsummaryrefslogtreecommitdiffstats
path: root/system/doc/design_principles
diff options
context:
space:
mode:
Diffstat (limited to 'system/doc/design_principles')
-rw-r--r--system/doc/design_principles/events.xml19
-rw-r--r--system/doc/design_principles/fsm.xml7
-rw-r--r--system/doc/design_principles/gen_server_concepts.xml7
-rw-r--r--system/doc/design_principles/sup_princ.xml8
4 files changed, 37 insertions, 4 deletions
diff --git a/system/doc/design_principles/events.xml b/system/doc/design_principles/events.xml
index 5579f1e459..23a9b8c7bc 100644
--- a/system/doc/design_principles/events.xml
+++ b/system/doc/design_principles/events.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>1997</year><year>2009</year>
+ <year>1997</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -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..edb2e20605 100644
--- a/system/doc/design_principles/fsm.xml
+++ b/system/doc/design_principles/fsm.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>1997</year><year>2009</year>
+ <year>1997</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -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..a904390999 100644
--- a/system/doc/design_principles/gen_server_concepts.xml
+++ b/system/doc/design_principles/gen_server_concepts.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>1997</year><year>2009</year>
+ <year>1997</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -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>
diff --git a/system/doc/design_principles/sup_princ.xml b/system/doc/design_principles/sup_princ.xml
index 067fd31961..2748f21bbe 100644
--- a/system/doc/design_principles/sup_princ.xml
+++ b/system/doc/design_principles/sup_princ.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>1997</year><year>2009</year>
+ <year>1997</year><year>2011</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -335,6 +335,12 @@ supervisor:start_child(Pid, [id1])</code>
<c>apply(call, start_link, []++[id1])</c>, or actually:</p>
<code type="none">
call:start_link(id1)</code>
+ <p>A child under a <c>simple_one_for_one</c> supervisor can be terminated
+ with</p>
+ <code type="none">
+supervisor:terminate_child(Sup, Pid)</code>
+ <p>where <c>Sup</c> is the pid, or name, of the supervisor and
+ <c>Pid</c> is the pid of the child.</p>
</section>
<section>