[erlang-questions] Possible supervisor patch

Robert Virding robert.virding@REDACTED
Sat Dec 18 15:58:02 CET 2010


You can do it today with:

restart_child(Sup, Id, NewSpec) ->
    supervisor:terminate_child(Sup, Id),
    supervisor:delete_child(Sup, Id),
    supervisor:start_child(Sup, NewSpec).

BUT, it would not be guaranteed to be an atomic operation and it is up to the caller to ensure that the id remains the same.

Robert

----- "Filipe David Manana" <fdmanana@REDACTED> wrote:

> Hi,
> 
> I find it useful to be able to restart a supervisor child with
> arguments different from those specified in the MFA component of the
> original child spec.
> Is this completely against the principles of OTP supervisors/servers,
> or something that may be added?
> 
> I made a quick and tiny patch that adds this feature and is working as
> I want:
> 
> https://github.com/fdmanana/otp/commit/a80f39109292c915ce56ea86b7e036b581f686b2
> 
> If someone from the OTP team confirms this might be considered for
> inclusion, I'll be glad to refine it if necessary.
> 
> best regards,
> 
> -- 
> Filipe David Manana,
> fdmanana@REDACTED, fdmanana@REDACTED
> 
> "Reasonable men adapt themselves to the world.
>  Unreasonable men adapt the world to themselves.
>  That's why all progress depends on unreasonable men."
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED

-- 
Robert Virding, Erlang Solutions Ltd.


More information about the erlang-questions mailing list