diff options
Diffstat (limited to 'system/doc')
22 files changed, 91 insertions, 58 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> diff --git a/system/doc/efficiency_guide/advanced.xml b/system/doc/efficiency_guide/advanced.xml index 8126b93a2d..821175bb09 100644 --- a/system/doc/efficiency_guide/advanced.xml +++ b/system/doc/efficiency_guide/advanced.xml @@ -34,7 +34,7 @@ <p>A good start when programming efficiently is to have knowledge about how much memory different data types and operations require. It is implementation-dependent how much memory the Erlang data types and - other items consume, but here are some figures for + other items consume, but here are some figures for the erts-5.2 system (OTP release R9B). (There have been no significant changes in R13.)</p> diff --git a/system/doc/efficiency_guide/appendix.xml b/system/doc/efficiency_guide/appendix.xml index 631ef9bee7..6eaaeffbc4 100644 --- a/system/doc/efficiency_guide/appendix.xml +++ b/system/doc/efficiency_guide/appendix.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2002</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/system/doc/efficiency_guide/binaryhandling.xml b/system/doc/efficiency_guide/binaryhandling.xml index 8746de4b60..425d6308cf 100644 --- a/system/doc/efficiency_guide/binaryhandling.xml +++ b/system/doc/efficiency_guide/binaryhandling.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2007</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> @@ -114,7 +114,7 @@ my_binary_to_list(<<>>) -> [].]]></code> data. For each field that is matched out of a binary, the position in the match context will be incremented.</p> - <p>In R11B, a match context was only using during a binary matching + <p>In R11B, a match context was only used during a binary matching operation.</p> <p>In R12B, the compiler tries to avoid generating code that @@ -205,7 +205,7 @@ Bin4 = <<Bin1/binary,17>>, %% 5 !!! ProcBin for the binary. The reason is that the binary object can be moved (reallocated) during an append operation, and when that happens the pointer in the ProcBin must be updated. If there would be more than - on ProcBin pointing to the binary object, it would not be possible to + one ProcBin pointing to the binary object, it would not be possible to find and update all of them.</p> <p>Therefore, certain operations on a binary will mark it so that @@ -291,7 +291,7 @@ my_binary_to_list(<<>>) -> [].]]></code> that initializes the matching operation will basically do nothing when it sees that it was passed a match context instead of a binary.</p> - <p>When the end of the binary is reached and second clause matches, + <p>When the end of the binary is reached and the second clause matches, the match context will simply be discarded (removed in the next garbage collection, since there is no longer any reference to it).</p> diff --git a/system/doc/efficiency_guide/drivers.xml b/system/doc/efficiency_guide/drivers.xml index 9fe54fb19a..fec68ca059 100644 --- a/system/doc/efficiency_guide/drivers.xml +++ b/system/doc/efficiency_guide/drivers.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2009</year><year>2009</year> + <year>2009</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -40,7 +40,7 @@ any code in a driver.</p> <p>By default, that lock will be at the driver level, meaning that - if several ports has been opened to the same driver, only code for + if several ports have been opened to the same driver, only code for one port at the same time can be running.</p> <p>A driver can be configured to instead have one lock for each port.</p> diff --git a/system/doc/efficiency_guide/functions.xml b/system/doc/efficiency_guide/functions.xml index fe14a4f000..42cc81dbae 100644 --- a/system/doc/efficiency_guide/functions.xml +++ b/system/doc/efficiency_guide/functions.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2001</year><year>2010</year> + <year>2001</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -127,7 +127,7 @@ map_pairs2(_Map, [_|_]=Xs, [] ) -> map_pairs2(Map, [X|Xs], [Y|Ys]) -> [Map(X, Y)|map_pairs2(Map, Xs, Ys)].]]></code> - <p>the compiler is free rearrange the clauses. It will generate code + <p>the compiler is free to rearrange the clauses. It will generate code similar to this</p> <p><em>DO NOT (already done by the compiler)</em></p> diff --git a/system/doc/efficiency_guide/myths.xml b/system/doc/efficiency_guide/myths.xml index 65113c9372..6fdeb5c4f9 100644 --- a/system/doc/efficiency_guide/myths.xml +++ b/system/doc/efficiency_guide/myths.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>2007</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/system/doc/efficiency_guide/processes.xml b/system/doc/efficiency_guide/processes.xml index a25ec53370..440be2b6f8 100644 --- a/system/doc/efficiency_guide/processes.xml +++ b/system/doc/efficiency_guide/processes.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2001</year><year>2009</year> + <year>2001</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -105,7 +105,7 @@ loop() -> <seealso marker="erts:erlang#spawn_opt/4">spawn_opt/4</seealso>.</p> <p>The gain is twofold: Firstly, although the garbage collector will - grow the heap, it will it grow it step by step, which will be more + grow the heap, it will grow it step by step, which will be more costly than directly establishing a larger heap when the process is spawned. Secondly, the garbage collector may also shrink the heap if it is much larger than the amount of data stored on it; @@ -172,7 +172,7 @@ days_in_month(M) -> <p>Shared sub-terms are <em>not</em> preserved when a term is sent to another process, passed as the initial process arguments in the <c>spawn</c> call, or stored in an ETS table. - That is an optimization. Most applications do not send message + That is an optimization. Most applications do not send messages with shared sub-terms.</p> <p>Here is an example of how a shared sub-term can be created:</p> @@ -237,8 +237,8 @@ true <section> <title>The SMP emulator</title> - <p>The SMP emulator (introduced in R11B) will take advantage of - multi-core or multi-CPU computer by running several Erlang schedulers + <p>The SMP emulator (introduced in R11B) will take advantage of a + multi-core or multi-CPU computer by running several Erlang scheduler threads (typically, the same as the number of cores). Each scheduler thread schedules Erlang processes in the same way as the Erlang scheduler in the non-SMP emulator.</p> diff --git a/system/doc/efficiency_guide/profiling.xml b/system/doc/efficiency_guide/profiling.xml index 65d13408bc..13165a0ede 100644 --- a/system/doc/efficiency_guide/profiling.xml +++ b/system/doc/efficiency_guide/profiling.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2001</year><year>2009</year> + <year>2001</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -74,7 +74,7 @@ <title>What to look for</title> <p>When analyzing the result file from the profiling activity you should look for functions that are called many - times and have a long "own" execution time (time excluded calls + times and have a long "own" execution time (time excluding calls to other functions). Functions that just are called very many times can also be interesting, as even small things can add up to quite a bit if they are repeated often. Then you need to @@ -87,7 +87,7 @@ <item>Are there redundant tests that can be removed? </item> <item>Is there some expression calculated giving the same result each time? </item> - <item>Is there other ways of doing this that are equivalent and + <item>Are there other ways of doing this that are equivalent and more efficient?</item> <item>Can I use another internal data representation to make things more efficient? </item> @@ -138,7 +138,7 @@ <p><c>cprof</c> is something in between <c>fprof</c> and <c>cover</c> regarding features. It counts how many times each function is called when the program is run, on a per module - basis. <c>cprof</c> has a low performance degradation (versus + basis. <c>cprof</c> has a low performance degradation effect (versus <c>fprof</c> and <c>eprof</c>) and does not need to recompile any modules to profile (versus <c>cover</c>).</p> </section> @@ -231,7 +231,7 @@ consistent from run to run. The disadvantage is that the time spent in the operating system kernel (such as swapping and I/O) are not included. Therefore, measuring CPU time is misleading if - any I/O (file or sockets) are involved.</p> + any I/O (file or socket) is involved.</p> <p>It is probably a good idea to do both wall-clock measurements and CPU time measurements.</p> @@ -239,18 +239,18 @@ <p>Some additional advice:</p> <list type="bulleted"> - <item>The granularity of both types measurement could be quite + <item>The granularity of both types of measurement could be quite high so you should make sure that each individual measurement lasts for at least several seconds.</item> <item>To make the test fair, each new test run should run in its own, - newly created Erlang process. Otherwise, if all tests runs in the + newly created Erlang process. Otherwise, if all tests run in the same process, the later tests would start out with larger heap sizes - and therefore probably does less garbage collections. You could + and therefore probably do less garbage collections. You could also consider restarting the Erlang emulator between each test.</item> <item>Do not assume that the fastest implementation of a given algorithm - on computer architecture X also is the fast on computer architecture Y.</item> + on computer architecture X also is the fastest on computer architecture Y.</item> </list> </section> diff --git a/system/doc/efficiency_guide/tablesDatabases.xml b/system/doc/efficiency_guide/tablesDatabases.xml index 4b53348c4c..0c32ae2d82 100644 --- a/system/doc/efficiency_guide/tablesDatabases.xml +++ b/system/doc/efficiency_guide/tablesDatabases.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2001</year><year>2009</year> + <year>2001</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -280,9 +280,9 @@ lists:filter(fun(X) -> X#person.name == "Bryan" end, TabList), <p>A simple solution would be to use the <c>name</c> field as the key instead of the <c>idno</c> field, but that would cause problems if the names were not unique. A more general solution - would be create a second table with name as key and idno as - data, i.e. to index (invert) the table with regards to the - <c>name</c> field. The second table would of course have to be + would be to create a second table with <c>name</c> as key and + <c>idno</c> as data, i.e. to index (invert) the table with regards + to the <c>name</c> field. The second table would of course have to be kept consistent with the master table. Mnesia could do this for you, but a home brew index table could be very efficient compared to the overhead involved in using Mnesia.</p> diff --git a/system/doc/embedded/intro.xml b/system/doc/embedded/intro.xml index 3eafffd6fa..545500c9c9 100644 --- a/system/doc/embedded/intro.xml +++ b/system/doc/embedded/intro.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1997</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/system/doc/embedded/vme_problems.xml b/system/doc/embedded/vme_problems.xml index 7f9b929875..03a70bae3b 100644 --- a/system/doc/embedded/vme_problems.xml +++ b/system/doc/embedded/vme_problems.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1997</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/system/doc/embedded/xntp.xml b/system/doc/embedded/xntp.xml index 564b63fc7d..270d986cf1 100644 --- a/system/doc/embedded/xntp.xml +++ b/system/doc/embedded/xntp.xml @@ -5,7 +5,7 @@ <header> <copyright> <year>1997</year> - <year>2007</year> + <year>2011</year> <holder>Ericsson AB, All Rights Reserved</holder> </copyright> <legalnotice> diff --git a/system/doc/getting_started/seq_prog.xml b/system/doc/getting_started/seq_prog.xml index bc1758d855..96876ea513 100644 --- a/system/doc/getting_started/seq_prog.xml +++ b/system/doc/getting_started/seq_prog.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2003</year><year>2009</year> + <year>2003</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -41,9 +41,9 @@ <c>erl</c>, you will see something like this.</p> <pre> % <input>erl</input> -Erlang (BEAM) emulator version 5.2 [source] [hipe] +Erlang R15B (erts-5.9.1) [source] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:false] -Eshell V5.2 (abort with ^G) +Eshell V5.9.1 (abort with ^G) 1></pre> <p>Now type in "2 + 5." as shown below.</p> <pre> @@ -245,7 +245,7 @@ convert(N, centimeter) -> inch in the convert function:</p> <pre> 12> <input>tut2:convert(3, miles).</input> -** exception error: no function clause matching tut2:convert(3,miles)</pre> +** exception error: no function clause matching tut2:convert(3,miles) (tut2.erl, line 4)</pre> <p>The two parts of the <c>convert</c> function are called its clauses. Here we see that "miles" is not part of either of the clauses. The Erlang system can't <em>match</em> either of @@ -255,11 +255,13 @@ convert(N, centimeter) -> command <c>v/1</c>:</p> <pre> 13> <input>v(12).</input> -{'EXIT',{function_clause,[{tut2,convert,[3,miles]}, - {erl_eval,do_apply,5}, - {shell,exprs,6}, - {shell,eval_exprs,6}, - {shell,eval_loop,3}]}}</pre> +{'EXIT',{function_clause,[{tut2,convert, + [3,miles], + [{file,"tut2.erl"},{line,4}]}, + {erl_eval,do_apply,5,[{file,"erl_eval.erl"},{line,482}]}, + {shell,exprs,7,[{file,"shell.erl"},{line,666}]}, + {shell,eval_exprs,7,[{file,"shell.erl"},{line,621}]}, + {shell,eval_loop,3,[{file,"shell.erl"},{line,606}]}]}}</pre> </section> @@ -943,7 +945,7 @@ A == 1 ; B == 7 a_equals_1_or_b_equals_7 66> <input>tut9:test_if(33, 33).</input> ** exception error: no true branch found when evaluating an if expression - in function tut9:test_if/2</pre> + in function tut9:test_if/2 (tut9.erl, line 5)</pre> <p>Notice that <c>tut9:test_if(33,33)</c> did not cause any condition to succeed so we got the run time error <c>if_clause</c>, here nicely formatted by the shell. See the chapter diff --git a/system/doc/reference_manual/distributed.xml b/system/doc/reference_manual/distributed.xml index 52222c6d9d..9c8e88250c 100644 --- a/system/doc/reference_manual/distributed.xml +++ b/system/doc/reference_manual/distributed.xml @@ -78,7 +78,7 @@ dilbert@uab</pre> using the command line flag <c>-connect_all false</c>, see <c>erl(1)</c>.</p> <p>If a node goes down, all connections to that node are removed. - Calling <c>erlang:disconnect(Node)</c> will force disconnection + Calling <c>erlang:disconnect_node(Node)</c> will force disconnection of a node.</p> <p>The list of (visible) nodes currently connected to is returned by <c>nodes()</c>.</p> diff --git a/system/doc/reference_manual/errors.xml b/system/doc/reference_manual/errors.xml index 02885a3813..4e207021d3 100644 --- a/system/doc/reference_manual/errors.xml +++ b/system/doc/reference_manual/errors.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2003</year><year>2009</year> + <year>2003</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -48,10 +48,8 @@ The Erlang programming language has built-in features for handling of run-time errors.</p> <p>A run-time error can also be emulated by calling - <c>erlang:error(Reason)</c>, <c>erlang:error(Reason, Args)</c> - (those appeared in Erlang 5.4/OTP-R10), - <c>erlang:fault(Reason)</c> or <c>erlang:fault(Reason, Args)</c> - (old equivalents).</p> + <c>erlang:error(Reason)</c> or <c>erlang:error(Reason, Args)</c> + (those appeared in Erlang 5.4/OTP-R10).</p> <p>A run-time error is another name for an exception of class <c>error</c>. </p> @@ -91,7 +89,7 @@ </row> <row> <cell align="left" valign="middle"><c>error</c></cell> - <cell align="left" valign="middle">Run-time error for example <c>1+a</c>, or the process called <c>erlang:error/1,2</c> (appeared in Erlang 5.4/OTP-R10B) or <c>erlang:fault/1,2</c> (old equivalent)</cell> + <cell align="left" valign="middle">Run-time error for example <c>1+a</c>, or the process called <c>erlang:error/1,2</c> (appeared in Erlang 5.4/OTP-R10B)</cell> </row> <row> <cell align="left" valign="middle"><c>exit</c></cell> @@ -108,7 +106,7 @@ and a stack trace (that aids in finding the code location of the exception).</p> <p>The stack trace can be retrieved using - <c>erlang:get_stacktrace/0</c> (new in Erlang 5.4/OTP-R10B + <c>erlang:get_stacktrace/0</c> (new in Erlang 5.4/OTP-R10B) from within a <c>try</c> expression, and is returned for exceptions of class <c>error</c> from a <c>catch</c> expression.</p> <p>An exception of class <c>error</c> is also known as a run-time diff --git a/system/doc/reference_manual/expressions.xml b/system/doc/reference_manual/expressions.xml index 714ecccaf6..497d7eb464 100644 --- a/system/doc/reference_manual/expressions.xml +++ b/system/doc/reference_manual/expressions.xml @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2003</year><year>2010</year> + <year>2003</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -269,7 +269,7 @@ fun lists:append/2([1,2], [3,4]) set of auto-imported BIFs does not silently change the behavior of old code.</p> - <p>However, to avoid that old (pre R14) code changed it's + <p>However, to avoid that old (pre R14) code changed its behavior when compiled with OTP version R14A or later, the following restriction applies: If you override the name of a BIF that was auto-imported in OTP versions prior to R14A (ERTS version diff --git a/system/doc/tutorial/c_port.xmlsrc b/system/doc/tutorial/c_port.xmlsrc index b4caa07578..b139fe0678 100644 --- a/system/doc/tutorial/c_port.xmlsrc +++ b/system/doc/tutorial/c_port.xmlsrc @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2000</year><year>2009</year> + <year>2000</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> diff --git a/system/doc/tutorial/nif.xmlsrc b/system/doc/tutorial/nif.xmlsrc index f9197c69dd..6cb54ff7ff 100644 --- a/system/doc/tutorial/nif.xmlsrc +++ b/system/doc/tutorial/nif.xmlsrc @@ -4,7 +4,7 @@ <chapter> <header> <copyright> - <year>2000</year><year>2009</year> + <year>2000</year><year>2011</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> |