Yarin Nim
Yarin Nim

Reputation: 3817

Kill all gen_server by supervisor in Erlang

In Erlang, I have a supervisor (my_sup) module to starts and monitor the gen_server process (my_gen). When the my_gen is modified, compiled and loaded, I need to restart the application.

Is there any better way to kill all the process (gen_server) by the supervisor (my_sup) and restart the process (gen_server) again?

Upvotes: 0

Views: 211

Answers (1)

Yarin Nim
Yarin Nim

Reputation: 3817

To fix this is to stop the child and restart it.

Stop and reload the childs

restart_pool() ->
    supervisor:terminate_child(?SEVER, ?WORKER),
    supervisor:restart_child(?SERVER, ?WORKER).

Upvotes: 0

Related Questions