@@ -230,7 +230,14 @@ defmodule DynamicSupervisor do
230
230
@ typedoc "Supported strategies"
231
231
@ type strategy :: :one_for_one
232
232
233
- @ typedoc "Return values of `start_child` functions"
233
+ @ typedoc """
234
+ Return values of `start_child` functions.
235
+
236
+ Unlike `Supervisor`, this module ignores the child spec ids, so
237
+ `{:error, {:already_started, pid}}` is not returned for child specs given with the same id.
238
+ `{:error, {:already_started, pid}}` is returned however if a duplicate name is used when using
239
+ [name registration](`m:GenServer#module-name-registration`).
240
+ """
234
241
@ type on_start_child ::
235
242
{ :ok , pid }
236
243
| { :ok , pid , info :: term }
@@ -400,11 +407,13 @@ defmodule DynamicSupervisor do
400
407
@ doc """
401
408
Dynamically adds a child specification to `supervisor` and starts that child.
402
409
403
- `child_spec` should be a valid child specification as detailed in the
404
- "Child specification" section of the documentation for `Supervisor`. The child
405
- process will be started as defined in the child specification. Note that while
410
+ `child_spec` should be a valid [child specification](`m:Supervisor#module-child-specification`).
411
+ The child process will be started as defined in the child specification. Note that while
406
412
the `:id` field is still required in the spec, the value is ignored and
407
- therefore does not need to be unique.
413
+ therefore does not need to be unique. Unlike `Supervisor`, this module does not
414
+ return `{:error, {:already_started, pid}}` for child specs given with the same id.
415
+ `{:error, {:already_started, pid}}` is returned however if a duplicate name is
416
+ used when using [name registration](`m:GenServer#module-name-registration`).
408
417
409
418
If the child process start function returns `{:ok, child}` or `{:ok, child,
410
419
info}`, then child specification and PID are added to the supervisor and
0 commit comments