[erlang-questions] Restarting processes
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)
case whereis(demux_name) of
undefined -> receive after 1000 -> assert_demux() end;
Pid -> Pid
>> * the demux has an ets table with all worker pids, and notify them at
> 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.
More information about the erlang-questions