DynamicSupervisor.start_child
start_child
, go back to DynamicSupervisor module for more information.
Specs
start_child( Supervisor.supervisor(), Supervisor.child_spec() | {module(), term()} | module() | (old_erlang_child_spec :: :supervisor.child_spec()) ) :: on_start_child()
Dynamically adds a child specification to supervisor
and starts that child.
child_spec
should be a valid child specification as detailed in the
"Child specification" section of the documentation for Supervisor
. The child
process will be started as defined in the child specification.
If the child process start function returns {:ok, child}
or {:ok, child, info}
, then child specification and PID are added to the supervisor and
this function returns the same value.
If the child process start function returns :ignore
, then no child is added
to the supervision tree and this function returns :ignore
too.
If the child process start function returns an error tuple or an erroneous
value, or if it fails, the child specification is discarded and this function
returns {:error, error}
where error
is the error or erroneous value
returned from child process start function, or failure reason if it fails.
If the supervisor already has N children in a way that N exceeds the amount
of :max_children
set on the supervisor initialization (see init/1
), then
this function returns {:error, :max_children}
.