aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/supervisor_deadlock.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2016-02-10 11:10:18 +0100
committerSiri Hansen <[email protected]>2016-02-10 11:13:35 +0100
commit8fba155bdc0b45f0504756d1ea695d9c53a44f80 (patch)
tree20743b3da8707882935c995c77e05b2da9ed7c29 /lib/stdlib/test/supervisor_deadlock.erl
parent439292ad4afe73243852fe79d5d467c325f382bf (diff)
parent264a5e804d6e23bf6c6916887669760cbf243caa (diff)
downloadotp-8fba155bdc0b45f0504756d1ea695d9c53a44f80.tar.gz
otp-8fba155bdc0b45f0504756d1ea695d9c53a44f80.tar.bz2
otp-8fba155bdc0b45f0504756d1ea695d9c53a44f80.zip
Merge branch 'nybek/speed_up_supervisor_count_children' into maint
* nybek/speed_up_supervisor_count_children: Speed up supervisor:count_children/1; simple_one_for_one Add supervisor:get_callback_module/1 OTP-13290
Diffstat (limited to 'lib/stdlib/test/supervisor_deadlock.erl')
-rw-r--r--lib/stdlib/test/supervisor_deadlock.erl14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/stdlib/test/supervisor_deadlock.erl b/lib/stdlib/test/supervisor_deadlock.erl
index 288547a972..8d3d1c6f30 100644
--- a/lib/stdlib/test/supervisor_deadlock.erl
+++ b/lib/stdlib/test/supervisor_deadlock.erl
@@ -11,9 +11,11 @@ init([child]) ->
%% terminates immediately
{ok, []};
[{fail_start, true}] ->
- %% Restart frequency is MaxR=8, MaxT=10, so this will
- %% ensure that restart intensity is not reached -> restart
- %% loop
+ %% A restart frequency of MaxR=8, MaxT=10 should ensure
+ %% that restart intensity is not reached -> restart loop.
+ %% (Note that if we use simple_one_for_one, and start
+ %% 'many' child instances, the restart frequency must be
+ %% ajusted accordingly.)
timer:sleep(2000), % NOTE: this could be a gen_server call timeout
{stop, error}
@@ -41,5 +43,11 @@ code_change(_OldVsn, State, _Extra) ->
start_child() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [child], []).
+start_child_noreg() ->
+ gen_server:start_link(?MODULE, [child], []).
+
restart_child() ->
gen_server:cast(supervisor_deadlock, restart).
+
+restart_child(Pid) ->
+ gen_server:cast(Pid, restart).