aboutsummaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorSteve Vinoski <[email protected]>2014-03-19 11:49:12 -0400
committerSteve Vinoski <[email protected]>2014-03-21 10:19:51 -0400
commitcbcac6f0d55907dda2e0c385eba44eac2e7923d2 (patch)
treea6042248fc283f94bb7247cd9763177c0ec88533 /system
parent6c298a7bfa332e5b7d153648d741740abc3bcdf8 (diff)
downloadotp-cbcac6f0d55907dda2e0c385eba44eac2e7923d2.tar.gz
otp-cbcac6f0d55907dda2e0c385eba44eac2e7923d2.tar.bz2
otp-cbcac6f0d55907dda2e0c385eba44eac2e7923d2.zip
remove tuple funs from special process documentation
Support for tuple funs was removed in R16B but the documentation for special processes, sys, and proc_lib in the OTP Design Principles still showed examples using them, and those examples no longer worked. Fix the examples to use regular functions instead and fix the documentation to reflect the changes.
Diffstat (limited to 'system')
-rw-r--r--system/doc/design_principles/spec_proc.xml37
1 files changed, 14 insertions, 23 deletions
diff --git a/system/doc/design_principles/spec_proc.xml b/system/doc/design_principles/spec_proc.xml
index d55427aa10..69bf2e0448 100644
--- a/system/doc/design_principles/spec_proc.xml
+++ b/system/doc/design_principles/spec_proc.xml
@@ -157,15 +157,15 @@ init(Parent) ->
loop(Chs, Parent, Deb) ->
receive
{From, alloc} ->
- Deb2 = sys:handle_debug(Deb, {ch4, write_debug},
+ Deb2 = sys:handle_debug(Deb, fun ch4:write_debug/3,
ch4, {in, alloc, From}),
{Ch, Chs2} = alloc(Chs),
From ! {ch4, Ch},
- Deb3 = sys:handle_debug(Deb2, {ch4, write_debug},
+ Deb3 = sys:handle_debug(Deb2, fun ch4:write_debug/3,
ch4, {out, {ch4, Ch}, From}),
loop(Chs2, Parent, Deb3);
{free, Ch} ->
- Deb2 = sys:handle_debug(Deb, {ch4, write_debug},
+ Deb2 = sys:handle_debug(Deb, fun ch4:write_debug/3,
ch4, {in, {free, Ch}}),
Chs2 = free(Ch, Chs),
loop(Chs2, Parent, Deb2);
@@ -185,13 +185,8 @@ system_get_state(Chs) ->
{ok, Chs}.
system_replace_state(StateFun, Chs) ->
- try
- NChs = StateFun(Chs),
- {ok, NChs, NChs}
- catch
- _:_ ->
- {ok, Chs, Chs}
- end.
+ NChs = StateFun(Chs),
+ {ok, NChs, NChs}.
write_debug(Dev, Event, Name) ->
io:format(Dev, "~p event = ~p~n", [Name, Event]).</pre>
@@ -294,10 +289,10 @@ sys:handle_debug(Deb, Func, Info, Event) => Deb1</code>
<p><c>Deb</c> is the debug structure.</p>
</item>
<item>
- <p><c>Func</c> is a tuple <c>{Module, Name}</c> (or a fun) and
- should specify a (user defined) function used to format
+ <p><c>Func</c> is a fun specifying
+ a (user defined) function used to format
trace output. For each system event, the format function is
- called as <c>Module:Name(Dev, Event, Info)</c>, where:</p>
+ called as <c>Func(Dev, Event, Info)</c>, where:</p>
<list type="bulleted">
<item>
<p><c>Dev</c> is the IO device to which the output should
@@ -332,15 +327,15 @@ sys:handle_debug(Deb, Func, Info, Event) => Deb1</code>
loop(Chs, Parent, Deb) ->
receive
{From, alloc} ->
- Deb2 = sys:handle_debug(Deb, {ch4, write_debug},
+ Deb2 = sys:handle_debug(Deb, fun ch4:write_debug/3,
ch4, {in, alloc, From}),
{Ch, Chs2} = alloc(Chs),
From ! {ch4, Ch},
- Deb3 = sys:handle_debug(Deb2, {ch4, write_debug},
+ Deb3 = sys:handle_debug(Deb2, fun ch4:write_debug/3,
ch4, {out, {ch4, Ch}, From}),
loop(Chs2, Parent, Deb3);
{free, Ch} ->
- Deb2 = sys:handle_debug(Deb, {ch4, write_debug},
+ Deb2 = sys:handle_debug(Deb, fun ch4:write_debug/3,
ch4, {in, {free, Ch}}),
Chs2 = free(Ch, Chs),
loop(Chs2, Parent, Deb2);
@@ -409,13 +404,9 @@ system_get_state(Chs) ->
{ok, Chs, Chs}.
system_replace_state(StateFun, Chs) ->
- try
- NChs = StateFun(Chs),
- {ok, NChs, NChs}
- catch
- _:_ ->
- {ok, Chs, Chs}
- end.</code>
+ NChs = StateFun(Chs),
+ {ok, NChs, NChs}.
+</code>
<p>If the special process is set to trap exits, note that if
the parent process terminates, the expected behavior is to
terminate with the same reason:</p>