@@ -101,13 +101,10 @@ defmodule Supervisor do
101
101
102
102
## Start and shutdown
103
103
104
- When the supervisor starts, it traverses all children and retrieves
105
- each child specification. It is at this moment `{Stack, [:hello]}`
106
- becomes a child specification by calling `Stack.child_spec([:hello])`.
107
-
108
- Then the supervisor starts each child in the order they are defined.
109
- This is done by calling the function defined under the `:start` key
110
- in the child specification and typically defaults to `start_link/1`.
104
+ When the supervisor starts, it traverses all child specifications and
105
+ then starts each child in the order they are defined. This is done by
106
+ calling the function defined under the `:start` key in the child
107
+ specification and typically defaults to `start_link/1`.
111
108
112
109
The `start_link/1` (or a custom) is then called for each child process.
113
110
The `start_link/1` function must return `{:ok, pid}` where `pid` is the
@@ -301,7 +298,9 @@ defmodule Supervisor do
301
298
function.
302
299
303
300
You may also completely override the `child_spec/1` function in the Stack module
304
- and return your own child specification.
301
+ and return your own child specification. Note there is no guarantee the `child_spec/1`
302
+ function will be called by the Supervisor process, as other processes may invoke
303
+ it to retrieve the child specification before reaching the supervisor.
305
304
306
305
## Exit reasons and restarts
307
306
0 commit comments