aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2016-02-25 15:13:32 +0100
committerBjörn-Egil Dahlberg <[email protected]>2016-02-25 15:26:28 +0100
commit0ca09ee90d6384e74d1b18ab0e05f2c05fc03905 (patch)
treecee20d57c9b84f1720e36b75fc93c949906e85df /lib
parentbedde8c59e568b15bee4b36dc4e4eaa93d00f63a (diff)
downloadotp-0ca09ee90d6384e74d1b18ab0e05f2c05fc03905.tar.gz
otp-0ca09ee90d6384e74d1b18ab0e05f2c05fc03905.tar.bz2
otp-0ca09ee90d6384e74d1b18ab0e05f2c05fc03905.zip
kernel: Clarify heart option
Change scheduler responsiveness to 'check_schedulers'.
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/doc/src/heart.xml13
-rw-r--r--lib/kernel/src/heart.erl13
-rw-r--r--lib/kernel/test/heart_SUITE.erl10
3 files changed, 24 insertions, 12 deletions
diff --git a/lib/kernel/doc/src/heart.xml b/lib/kernel/doc/src/heart.xml
index a4569b5fb8..9da4773f2d 100644
--- a/lib/kernel/doc/src/heart.xml
+++ b/lib/kernel/doc/src/heart.xml
@@ -118,6 +118,13 @@
<p>In the following descriptions, all function fails with reason
<c>badarg</c> if <c>heart</c> is not started.</p>
</description>
+
+ <datatypes>
+ <datatype>
+ <name name="heart_option"/>
+ </datatype>
+ </datatypes>
+
<funcs>
<func>
<name name="set_cmd" arity="1"/>
@@ -188,12 +195,12 @@
<desc>
<p> Valid options <c>set_options</c> are: </p>
<taglist>
- <tag><c>scheduler</c></tag>
+ <tag><c>check_schedulers</c></tag>
<item>
- <p>If enabled, a message will be sent to each scheduler to check its
+ <p>If enabled, a signal will be sent to each scheduler to check its
responsiveness. The system check occurs before any heartbeat sent
to the port program. If any scheduler is not responsive enough the
- heart program will not receive its heartpeat and terminate the node.
+ heart program will not receive its heartbeat and thus eventually terminate the node.
</p>
</item>
</taglist>
diff --git a/lib/kernel/src/heart.erl b/lib/kernel/src/heart.erl
index 273bdcb352..d14598cd05 100644
--- a/lib/kernel/src/heart.erl
+++ b/lib/kernel/src/heart.erl
@@ -53,9 +53,14 @@
-define(CYCLE_TIMEOUT, 10000).
-define(HEART_PORT_NAME, heart_port).
+%% valid heart options
+-define(SCHEDULER_CHECK_OPT, check_schedulers).
+
+-type heart_option() :: ?SCHEDULER_CHECK_OPT.
+
-record(state,{port :: port(),
cmd :: [] | binary(),
- options :: [atom()],
+ options :: [heart_option()],
callback :: 'undefined' | {atom(), atom()}}).
%%---------------------------------------------------------------------
@@ -144,7 +149,7 @@ clear_callback() ->
wait().
-spec set_options(Options) -> 'ok' | {'error', {'bad_options', Options}} when
- Options :: [atom()].
+ Options :: [heart_option()].
set_options(Options) ->
?MODULE ! {self(), set_options, Options},
@@ -314,7 +319,7 @@ no_reboot_shutdown(Port) ->
validate_options(Opts) -> validate_options(Opts,[]).
validate_options([],Res) -> Res;
-validate_options([scheduler=Opt|Opts],Res) -> validate_options(Opts,[Opt|Res]);
+validate_options([?SCHEDULER_CHECK_OPT=Opt|Opts],Res) -> validate_options(Opts,[Opt|Res]);
validate_options(_,_) -> error.
do_cycle_port_program(Caller, Parent, #state{port=Port} = S) ->
@@ -365,7 +370,7 @@ get_heart_cmd(Port) ->
end.
check_system([]) -> ok;
-check_system([scheduler|Opts]) ->
+check_system([?SCHEDULER_CHECK_OPT|Opts]) ->
ok = erts_internal:system_check(schedulers),
check_system(Opts).
diff --git a/lib/kernel/test/heart_SUITE.erl b/lib/kernel/test/heart_SUITE.erl
index 6cf451b10b..39cd29cea0 100644
--- a/lib/kernel/test/heart_SUITE.erl
+++ b/lib/kernel/test/heart_SUITE.erl
@@ -407,15 +407,15 @@ options_api(Config) when is_list(Config) ->
{error, {bad_options, Ls}} = rpc:call(Node, heart, set_options, [Ls]),
none = rpc:call(Node, heart, get_options, []),
- ok = rpc:call(Node, heart, set_options, [[scheduler]]),
- {ok, [scheduler]} = rpc:call(Node, heart, get_options, []),
+ ok = rpc:call(Node, heart, set_options, [[check_schedulers]]),
+ {ok, [check_schedulers]} = rpc:call(Node, heart, get_options, []),
ok = rpc:call(Node, heart, set_options, [[]]),
none = rpc:call(Node, heart, get_options, []),
- ok = rpc:call(Node, heart, set_options, [[scheduler]]),
- {ok, [scheduler]} = rpc:call(Node, heart, get_options, []),
+ ok = rpc:call(Node, heart, set_options, [[check_schedulers]]),
+ {ok, [check_schedulers]} = rpc:call(Node, heart, get_options, []),
{error, {bad_options, Ls}} = rpc:call(Node, heart, set_options, [Ls]),
- {ok, [scheduler]} = rpc:call(Node, heart, get_options, []),
+ {ok, [check_schedulers]} = rpc:call(Node, heart, get_options, []),
receive after 3000 -> ok end, %% wait 3 secs