Packages
membrane_core
1.2.1
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.7
1.2.6
1.2.5
retired
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.2.0-rc1
1.1.2
1.1.1
1.1.0
1.1.0-rc1
1.1.0-rc0
1.0.1
1.0.0
1.0.0-rc1
1.0.0-rc0
0.12.9
0.12.8
0.12.7
0.12.6
0.12.5
0.12.4
0.12.3
0.12.2
0.12.1
0.12.0
retired
0.11.5
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.2
0.10.1
0.10.0
0.9.0
0.8.2
0.8.1
0.8.0
0.7.0
0.6.1
0.6.0
0.5.3
0.5.2
0.5.1
0.5.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.2
0.3.1
0.3.0
0.2.2
0.2.1
0.2.0
0.1.1
0.1.0
Membrane Multimedia Framework (Core)
Current section
Files
Jump to
Current section
Files
lib/membrane/utility_supervisor.ex
defmodule Membrane.UtilitySupervisor do
@moduledoc """
A supervisor responsible for managing utility processes under the pipeline's
supervision tree.
The supervisor is spawned with each component and can be accessed from callback contexts.
`Membrane.UtilitySupervisor` does not restart processes. Rather, it ensures that these utility processes
terminate gracefully when the component that initiated them terminates.
If a process needs to be able to restart, spawn a dedicated supervisor under this supervisor.
## Example
def handle_setup(ctx, state) do
Membrane.UtilitySupervisor.start_link_child(
ctx.utility_supervisor,
{MySupervisor, children: [SomeWorker, OtherWorker], restart: :one_for_one})
end
"""
@typedoc """
The pid of the `Membrane.UtilitySupervisor` process.
"""
@type t :: pid()
@doc """
Starts a process under the utility supervisor.
Semantics of the `child_spec` argument are the same as in `Supervisor.child_spec/2`.
"""
@spec start_child(t, Supervisor.child_spec() | {module(), term()} | module()) ::
Supervisor.on_start_child()
defdelegate start_child(supervisor, child_spec),
to: Membrane.Core.SubprocessSupervisor,
as: :start_utility
@doc """
Starts a process under the utility supervisor and links it to the current process.
Semantics of the `child_spec` argument are the same as in `Supervisor.child_spec/2`.
"""
@spec start_link_child(t, Supervisor.child_spec() | {module(), term()} | module()) ::
Supervisor.on_start_child()
defdelegate start_link_child(supervisor, child_spec),
to: Membrane.Core.SubprocessSupervisor,
as: :start_link_utility
end