[erlang-questions] Restarting processes
Mats Cronqvist
mats.cronqvist@REDACTED
Fri Mar 30 09:27:33 CEST 2007
Daniel Ginsburg wrote:
> Mats Cronqvist пишет:
>
>> i can see two easy ways to do this.
>> in either case the workers should monitor the demux.
>> * the workers poll on the demux registered name.
>
> You mean, calling whereis(demux_name) is a cycle? Well, if other
> approaches won't work, I think I'll do just that.
i'm not sure what you mean by "cycle". but something like (pseudo-code)
assert_demux() ->
case whereis(demux_name) of
undefined -> receive after 1000 -> assert_demux() end;
Pid -> Pid
end.
>> * the demux has an ets table with all worker pids, and notify them at
>> startup.
>
> I might be confused about how ets works, but if demux has an ets table
> and terminates, the table will vanish along with it's owner, won't it?
yes, the demux supervisor should own the table.
btw, ulf's "proc" thing is a, quite clever, generalization of this. unless
you use it, you'll probably end up reinventing it.
mats
More information about the erlang-questions
mailing list