Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

25 lignes
645 B

-module(tpTracerPool).
-behaviour(supervisor).
-export([
start_link/3
, init/1
, tracers/1
]).
start_link(NumTracers, TracerMod, Opts) ->
supervisor:start_link(?MODULE, [NumTracers, TracerMod, Opts]).
init([NumTracers, TracerMod, Opts]) ->
ChildSpecs = [
#{
id => {tracer, Index},
start => {TracerMod, start_link, [Index, Opts]},
restart => temporary
} || Index <- lists:seq(1, NumTracers)
],
SupFlags = #{strategy => one_for_all, intensity => 5, period => 10},
{ok, {SupFlags, ChildSpecs}}.
tracers(PoolPid) ->
[Pid || {_, Pid, _, _} <- supervisor:which_children(PoolPid)].