DynamicSupervisor.start_link
start_link
, go back to DynamicSupervisor module for more information.
Specs
start_link([option() | init_option()]) :: Supervisor.on_start()
Starts a supervisor with the given options.
The :strategy
is a required option and the currently supported
value is :one_for_one
. The remaining options can be found in the
init/1
docs.
The :name
option can also be used to register a supervisor name.
The supported values are described under the "Name registration"
section in the GenServer
module docs.
If the supervisor is successfully spawned, this function returns
{:ok, pid}
, where pid
is the PID of the supervisor. If the supervisor
is given a name and a process with the specified name already exists,
the function returns {:error, {:already_started, pid}}
, where pid
is the PID of that process.
Note that a supervisor started with this function is linked to the parent
process and exits not only on crashes but also if the parent process exits
with :normal
reason.
Specs
start_link(module(), term(), [option()]) :: Supervisor.on_start()
Starts a module-based supervisor process with the given module
and arg
.
To start the supervisor, the init/1
callback will be invoked in the given
module
, with arg
as its argument. The init/1
callback must return a
supervisor specification which can be created with the help of the init/1
function.
If the init/1
callback returns :ignore
, this function returns
:ignore
as well and the supervisor terminates with reason :normal
.
If it fails or returns an incorrect value, this function returns
{:error, term}
where term
is a term with information about the
error, and the supervisor terminates with reason term
.
The :name
option can also be given in order to register a supervisor
name, the supported values are described in the "Name registration"
section in the GenServer
module docs.