From 83d9a57a667a8cc0f5f47e96f0bc77579bacf77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20K=C3=B6=C3=B6k?= Date: Thu, 17 Feb 2022 16:23:10 +0200 Subject: [PATCH 1/2] add explanation for exit reason to gen_server --- lib/elixir/lib/gen_server.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/elixir/lib/gen_server.ex b/lib/elixir/lib/gen_server.ex index c5d82638299..bb948bbe968 100644 --- a/lib/elixir/lib/gen_server.ex +++ b/lib/elixir/lib/gen_server.ex @@ -153,6 +153,10 @@ defmodule GenServer do detailed information. The `@doc` annotation immediately preceding `use GenServer` will be attached to the generated `child_spec/1` function. + When stopping the GenServer, for example by returing a `{:stop, reason, new_state}` tuple from a + callback, the exit reason is used by the supervisor to determine whether the GenServer needs to be + restarted. See the "Exit reasons and restarts" section in the `Supervisor` module. + ## Name registration Both `start_link/3` and `start/3` support the `GenServer` to register From fdebb718919980b8e10e22a6268df225f9a1c6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 17 Feb 2022 15:31:58 +0100 Subject: [PATCH 2/2] Update lib/elixir/lib/gen_server.ex --- lib/elixir/lib/gen_server.ex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/elixir/lib/gen_server.ex b/lib/elixir/lib/gen_server.ex index bb948bbe968..24e112d7b91 100644 --- a/lib/elixir/lib/gen_server.ex +++ b/lib/elixir/lib/gen_server.ex @@ -153,9 +153,10 @@ defmodule GenServer do detailed information. The `@doc` annotation immediately preceding `use GenServer` will be attached to the generated `child_spec/1` function. - When stopping the GenServer, for example by returing a `{:stop, reason, new_state}` tuple from a - callback, the exit reason is used by the supervisor to determine whether the GenServer needs to be - restarted. See the "Exit reasons and restarts" section in the `Supervisor` module. + When stopping the GenServer, for example by returing a `{:stop, reason, new_state}` + tuple from a callback, the exit reason is used by the supervisor to determine + whether the GenServer needs to be restarted. See the "Exit reasons and restarts" + section in the `Supervisor` module. ## Name registration