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

il y a 3 ans
il y a 3 ans
  1. -module(tpTracerPool).
  2. -behaviour(supervisor).
  3. -export([
  4. start_link/3
  5. , init/1
  6. , tracers/1
  7. ]).
  8. start_link(NumTracers, TracerMod, Opts) ->
  9. supervisor:start_link(?MODULE, [NumTracers, TracerMod, Opts]).
  10. init([NumTracers, TracerMod, Opts]) ->
  11. ChildSpecs = [
  12. #{
  13. id => {tracer, Index},
  14. start => {TracerMod, start_link, [Index, Opts]},
  15. restart => temporary
  16. } || Index <- lists:seq(1, NumTracers)
  17. ],
  18. SupFlags = #{strategy => one_for_all, intensity => 5, period => 10},
  19. {ok, {SupFlags, ChildSpecs}}.
  20. tracers(PoolPid) ->
  21. [Pid || {_, Pid, _, _} <- supervisor:which_children(PoolPid)].