From b52a2170d13fe7ff6e4e3b146b63d8f68c2aaadf Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 28 Mar 2011 16:38:57 +0200 Subject: Improve algorithm in module random. Avoid seed values that are even divisors of the primes and by that prevent getting seeds that are stuck on zero. Example: random:seed(0,0,0) would produce a series of only zeros. --- lib/stdlib/doc/src/random.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/stdlib/doc/src') diff --git a/lib/stdlib/doc/src/random.xml b/lib/stdlib/doc/src/random.xml index dcc6d756e1..26f22db48e 100644 --- a/lib/stdlib/doc/src/random.xml +++ b/lib/stdlib/doc/src/random.xml @@ -4,7 +4,7 @@
- 19962009 + 19962011 Ericsson AB. All Rights Reserved. @@ -146,6 +146,11 @@ random_seed to remember the current seed.

If a process calls uniform/0 or uniform/1 without setting a seed first, seed/0 is called automatically.

+

The implementation changed in R15. Upgrading to R15 will break + applications that expect a specific output for a given seed. The output + is still deterministic number series, but different compared to releases + older than R15. The seed {0,0,0} will for example no longer + produce a flawed series of only zeros.

-- cgit v1.2.3 From 47759479146ca11ad81eca0bb3236b265e20601d Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 5 Sep 2011 12:42:33 +0200 Subject: Explicitly kill dynamic children in supervisors According to the supervisor's documentation: "Important note on simple-one-for-one supervisors: The dynamically created child processes of a simple-one-for-one supervisor are not explicitly killed, regardless of shutdown strategy, but are expected to terminate when the supervisor does (that is, when an exit signal from the parent process is received)." All is fine as long as we stop simple_one_for_one supervisor manually. Dynamic children catch the exit signal from the supervisor and leave. But, if this happens when we stop an application, after the top supervisor has stopped, the application master kills all remaining processes associated to this application. So, dynamic children that trap exit signals can be killed during their cleanup (here we mean inside terminate/2). This is unpredictable and highly time-dependent. In this commit, supervisor module is patched to explicitly terminate dynamic children accordingly to the shutdown strategy. NOTE: Order in which dynamic children are stopped is not defined. In fact, this is "almost" done at the same time. --- lib/stdlib/doc/src/supervisor.xml | 6 ------ 1 file changed, 6 deletions(-) (limited to 'lib/stdlib/doc/src') diff --git a/lib/stdlib/doc/src/supervisor.xml b/lib/stdlib/doc/src/supervisor.xml index edd119d37a..b4e81aba1f 100644 --- a/lib/stdlib/doc/src/supervisor.xml +++ b/lib/stdlib/doc/src/supervisor.xml @@ -171,12 +171,6 @@ child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules}

If the child process is another supervisor, Shutdown should be set to infinity to give the subtree ample time to shutdown.

-

Important note on simple-one-for-one supervisors: - The dynamically created child processes of a - simple-one-for-one supervisor are not explicitly killed, - regardless of shutdown strategy, but are expected to terminate - when the supervisor does (that is, when an exit signal from - the parent process is received).

Note that all child processes implemented using the standard OTP behavior modules automatically adhere to the shutdown protocol.

-- cgit v1.2.3 From 04731323678eff58f709b36f864d12aa08cfe6d9 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 14 Sep 2011 17:49:38 +0200 Subject: Explain how dynamic child processes are stopped --- lib/stdlib/doc/src/supervisor.xml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/stdlib/doc/src') diff --git a/lib/stdlib/doc/src/supervisor.xml b/lib/stdlib/doc/src/supervisor.xml index b4e81aba1f..9cc9b69dd9 100644 --- a/lib/stdlib/doc/src/supervisor.xml +++ b/lib/stdlib/doc/src/supervisor.xml @@ -94,6 +94,10 @@ instead the child specification identifier is used, terminate_child/2 will return {error,simple_one_for_one}.

+

Because a simple_one_for_one supervisor could have many + children, it shuts them all down at same time. So, order in which they + are stopped is not defined. For the same reason, it could have an + overhead with regards to the Shutdown strategy.

To prevent a supervisor from getting into an infinite loop of -- cgit v1.2.3 From 2c4e984bd1d75524fd6444dc2032f8d758a945ae Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 6 Sep 2011 11:10:43 +0200 Subject: Allow an infinite timeout to shutdown worker processes Now, in child specification, the shutdown value can also be set to infinity for worker children. This restriction was removed because this is not always possible to predict the shutdown time for a worker. This is highly application-dependent. --- lib/stdlib/doc/src/supervisor.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/stdlib/doc/src') diff --git a/lib/stdlib/doc/src/supervisor.xml b/lib/stdlib/doc/src/supervisor.xml index ec607d6e4c..b4baf2f0a0 100644 --- a/lib/stdlib/doc/src/supervisor.xml +++ b/lib/stdlib/doc/src/supervisor.xml @@ -169,7 +169,8 @@ child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules} exit(Child,kill).

If the child process is another supervisor, Shutdown should be set to infinity to give the subtree ample - time to shutdown.

+ time to shutdown. It is also allowed to set it to infinity, + if the child process is a worker.

Important note on simple-one-for-one supervisors: The dynamically created child processes of a simple-one-for-one supervisor are not explicitly killed, -- cgit v1.2.3 From 9679510bb27b569fd47394b6cb319916c3282de9 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 14 Sep 2011 14:30:47 +0200 Subject: Add a warning to docs about workers' shutdown strategy --- lib/stdlib/doc/src/supervisor.xml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/stdlib/doc/src') diff --git a/lib/stdlib/doc/src/supervisor.xml b/lib/stdlib/doc/src/supervisor.xml index b4baf2f0a0..54e7cab884 100644 --- a/lib/stdlib/doc/src/supervisor.xml +++ b/lib/stdlib/doc/src/supervisor.xml @@ -171,6 +171,13 @@ child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules} should be set to infinity to give the subtree ample time to shutdown. It is also allowed to set it to infinity, if the child process is a worker.

+ +

Be careful by setting the Shutdown strategy to + infinity when the child process is a worker. Because, in this + situation, the termination of the supervision tree depends on the + child process, it must be implemented in a safe way and its cleanup + procedure must always return.

+

Important note on simple-one-for-one supervisors: The dynamically created child processes of a simple-one-for-one supervisor are not explicitly killed, -- cgit v1.2.3 From 34db76765561487e526fe66d3d19ecf3b3fb9dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Tue, 30 Aug 2011 11:51:11 +0200 Subject: Allow noncharacter code points in unicode encoding and decoding The two noncharacter code points 16#FFFE and 16#FFFF were not allowed to be encoded or decoded using the unicode module or bit syntax. That causes an inconsistency, since the noncharacters 16#FDD0 to 16#FDEF could be encoded/decoded. There is two ways to fix that inconsistency. We have chosen to allow 16#FFFE and 16#FFFF to be encoded and decoded, because the noncharacters could be useful internally within an application and it will make encoding and decoding slightly faster. Reported-by: Alisdair Sullivan --- lib/stdlib/doc/src/unicode.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/stdlib/doc/src') diff --git a/lib/stdlib/doc/src/unicode.xml b/lib/stdlib/doc/src/unicode.xml index d02763f75c..1001ebbae4 100644 --- a/lib/stdlib/doc/src/unicode.xml +++ b/lib/stdlib/doc/src/unicode.xml @@ -203,8 +203,7 @@ greater than 16#10FFFF (the maximum unicode character), in the range 16#D800 to 16#DFFF - (invalid unicode range) - or equal to 16#FFFE or 16#FFFF (non characters) + (invalid range reserved for UTF-16 surrogate pairs) is found. -- cgit v1.2.3 From 6a37976806f9a0998d0970c17f0e176b6e19bdad Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Thu, 6 Oct 2011 15:08:09 +0200 Subject: Correct the docs --- lib/stdlib/doc/src/lists.xml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/stdlib/doc/src') diff --git a/lib/stdlib/doc/src/lists.xml b/lib/stdlib/doc/src/lists.xml index 6f3ed7af98..7042c84437 100644 --- a/lib/stdlib/doc/src/lists.xml +++ b/lib/stdlib/doc/src/lists.xml @@ -240,7 +240,7 @@ flatmap(Fun, List1) -> Delete an element from a list of tuples - 1..tuple_size(Tuple) + 1..tuple_size(Tuple)

Returns a copy of TupleList1 where the first occurrence of a tuple whose Nth element compares equal to @@ -266,7 +266,7 @@ flatmap(Fun, List1) -> Map a function over a list of tuples - 1..tuple_size(Tuple) + 1..tuple_size(Tuple)

Returns a list of tuples where, for each tuple in TupleList1, the Nth element Term1 of the tuple @@ -298,7 +298,7 @@ flatmap(Fun, List1) -> Merge two key-sorted lists of tuples - 1..tuple_size(Tuple) + 1..tuple_size(Tuple)

Returns the sorted list formed by merging TupleList1 and TupleList2. The merge is performed on @@ -312,7 +312,7 @@ flatmap(Fun, List1) -> Replace an element in a list of tuples - 1..tuple_size(Tuple) + 1..tuple_size(Tuple)

Returns a copy of TupleList1 where the first occurrence of a T tuple whose Nth element @@ -342,7 +342,7 @@ flatmap(Fun, List1) -> Sort a list of tuples - 1..tuple_size(Tuple) + 1..tuple_size(Tuple)

Returns a list containing the sorted elements of the list TupleList1. Sorting is performed on the Nth @@ -352,7 +352,7 @@ flatmap(Fun, List1) -> Store an element in a list of tuples - 1..tuple_size(Tuple) + 1..tuple_size(Tuple)

Returns a copy of TupleList1 where the first occurrence of a tuple T whose Nth element @@ -366,7 +366,7 @@ flatmap(Fun, List1) -> Extract an element from a list of tuples - 1..tuple_size(Tuple) + 1..tuple_size(Tuple)

Searches the list of tuples TupleList1 for a tuple whose Nth element compares equal to Key. @@ -500,7 +500,7 @@ flatmap(Fun, List1) -> Return the Nth element of a list - 1..length(List) + 1..length(List)

Returns the Nth element of List. For example:

@@ -511,7 +511,7 @@ c
Return the Nth tail of a list - 0..length(List) + 0..length(List)

Returns the Nth tail of List, that is, the sublist of List starting at N+1 and continuing up to @@ -630,7 +630,7 @@ length(lists:seq(From, To, Incr)) == (To-From+Incr) div Incr Split a list into two lists - 0..length(List1) + 0..length(List1)

Splits List1 into List2 and List3. List2 contains the first N elements and @@ -670,7 +670,7 @@ splitwith(Pred, List) -> Return a sub-list starting at a given position and with a given number of elements - 1..(length(List1)+1) + 1..(length(List1)+1)

Returns the sub-list of List1 starting at Start and with (max) Len elements. It is not an error for @@ -732,7 +732,7 @@ splitwith(Pred, List) -> Merge two key-sorted lists of tuples, removing duplicates - 1..tuple_size(Tuple) + 1..tuple_size(Tuple)

Returns the sorted list formed by merging TupleList1 and TupleList2. The merge is performed on the @@ -746,7 +746,7 @@ splitwith(Pred, List) -> Sort a list of tuples, removing duplicates - 1..tuple_size(Tuple) + 1..tuple_size(Tuple)

Returns a list containing the sorted elements of the list TupleList1 where all but the first tuple of the -- cgit v1.2.3 From c8053ef7b602e8c47b6fa8919b9bbff996d3a81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 20 Oct 2011 14:17:52 +0200 Subject: Remove unused */doc/src/make.dep files These dependency files was once used when building the documentation, but are no longer needed. --- lib/stdlib/doc/src/make.dep | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 lib/stdlib/doc/src/make.dep (limited to 'lib/stdlib/doc/src') diff --git a/lib/stdlib/doc/src/make.dep b/lib/stdlib/doc/src/make.dep deleted file mode 100644 index 48ee6209ef..0000000000 --- a/lib/stdlib/doc/src/make.dep +++ /dev/null @@ -1,40 +0,0 @@ -# ---------------------------------------------------- -# >>>> Do not edit this file <<<< -# This file was automaticly generated by -# /home/otp/bin/docdepend -# ---------------------------------------------------- - - -# ---------------------------------------------------- -# TeX files that the DVI file depend on -# ---------------------------------------------------- - -book.dvi: array.tex base64.tex beam_lib.tex book.tex \ - c.tex calendar.tex dets.tex dict.tex digraph.tex \ - digraph_utils.tex epp.tex erl_eval.tex erl_expand_records.tex \ - erl_id_trans.tex erl_internal.tex erl_lint.tex \ - erl_parse.tex erl_pp.tex erl_scan.tex erl_tar.tex \ - ets.tex file_sorter.tex filelib.tex filename.tex \ - gb_sets.tex gb_trees.tex gen_event.tex gen_fsm.tex \ - gen_server.tex io.tex io_lib.tex io_protocol.tex \ - lib.tex lists.tex log_mf_h.tex math.tex ms_transform.tex \ - orddict.tex ordsets.tex part.tex pg.tex pool.tex \ - proc_lib.tex proplists.tex qlc.tex queue.tex \ - random.tex re.tex ref_man.tex regexp.tex sets.tex \ - shell.tex shell_default.tex slave.tex sofs.tex \ - stdlib_app.tex string.tex supervisor.tex supervisor_bridge.tex \ - sys.tex timer.tex unicode.tex unicode_usage.tex \ - win32reg.tex zip.tex - -# ---------------------------------------------------- -# Source inlined when transforming from source to LaTeX -# ---------------------------------------------------- - -book.tex: ref_man.xml - -# ---------------------------------------------------- -# Pictures that the DVI file depend on -# ---------------------------------------------------- - -book.dvi: ushell1.ps - -- cgit v1.2.3