Skip to content

Commit d10514c

Browse files
eksperimentaljosevalim
authored andcommitted
Improve Supervisor docs and specs (#7871)
1 parent b0d8b64 commit d10514c

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/elixir/lib/supervisor.ex

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ defmodule Supervisor do
147147
The child specification describes how the supervisor starts, shuts down,
148148
and restarts child processes.
149149
150-
The child specification contains 5 keys. The first two are required,
150+
The child specification contains 6 keys. The first two are required,
151151
and the remaining ones are optional:
152152
153-
* `:id` - a value used to identify the child specification
153+
* `:id` - any term used to identify the child specification
154154
internally by the supervisor; defaults to the given module.
155155
In the case of conflicting `:id` values, the supervisor will refuse
156156
to initialize and require explicit IDs. This key is required.
@@ -338,7 +338,7 @@ defmodule Supervisor do
338338
restarts in transient mode, and linked processes exit with the same
339339
reason unless they're trapping exits
340340
341-
Notice that supervisor that reached maximum restart intensity will exit with
341+
Notice that the supervisor that reaches maximum restart intensity will exit with
342342
`:shutdown` reason. In this case the supervisor will only be restarted if its
343343
child specification was defined with the `:restart` option set to `:permanent`
344344
(the default).
@@ -390,7 +390,7 @@ defmodule Supervisor do
390390
can run as a child of another supervision in the tree. The generated
391391
`child_spec/1` can be customized with the following options:
392392
393-
* `:id` - the child specification id, defaults to the current module
393+
* `:id` - the child specification identifier, defaults to the current module
394394
* `:start` - how to start the child process (defaults to calling `__MODULE__.start_link/1`)
395395
* `:restart` - when the supervisor should be restarted, defaults to `:permanent`
396396
@@ -440,10 +440,9 @@ defmodule Supervisor do
440440
processes are terminated and then all child processes (including
441441
the terminated one) are restarted.
442442
443-
* `:rest_for_one` - if a child process terminates, the "rest" of
444-
the child processes, i.e., the child processes after the terminated
445-
one in start order, are terminated. Then the terminated child
446-
process and the rest of the child processes are restarted.
443+
* `:rest_for_one` - if a child process terminates, the terminated child
444+
process and the rest of the children started after it, are terminated and
445+
restarted.
447446
448447
In the above, process termination refers to unsuccessful termination, which
449448
is determined by the `:restart` option.
@@ -452,7 +451,7 @@ defmodule Supervisor do
452451
has been replaced by the `DynamicSupervisor`. The `:simple_one_for_one`
453452
supervisor was similar to `:one_for_one` but suits better when dynamically
454453
attaching children. Many functions in this module behaved slightly
455-
differently when this strategy is used. See the `DynamicSupervisor` module
454+
differently when this strategy was used. See the `DynamicSupervisor` module
456455
for more information and migration strategies.
457456
458457
## Name registration
@@ -534,7 +533,7 @@ defmodule Supervisor do
534533
# Note we have inlined all types for readability
535534
@typedoc "The supervisor specification"
536535
@type child_spec :: %{
537-
required(:id) => term(),
536+
required(:id) => atom() | term(),
538537
required(:start) => {module(), atom(), [term()]},
539538
optional(:restart) => :permanent | :transient | :temporary,
540539
optional(:shutdown) => timeout() | :brutal_kill,

0 commit comments

Comments
 (0)