[erlang-questions] why call code:purge(Module) twice?
Gijsbert de Haan
Wed Mar 11 03:55:29 CET 2009
To get started with my Erlang server I've scavenged some code from
erlyvideo. So far it has been very helpful, but I am a bit confused
about this code reload function:
reload(Module) when is_atom(Module) ->
reload() -> ok;
reload([?MODULE | T]) -> reload(T);
It reloads the list of modules that make up my server. What I don't
understand is why it calls reload(Module) twice.
If I understand the Erlang documentation correctly calling code:purge()
twice will kill all running erlang processes, making it pretty much a
cold code start.
What would be a reason to do this? I can imagine that sometimes old
processes wouldn't be able to cope with processes running new code, in
which a clean start would be needed. But in that case a graceful stop
and start would be nicer.
More information about the erlang-questions