[erlang-questions] Design to Avoid Races

Evgeniy Khramtsov hev@REDACTED
Sat Sep 16 04:46:38 CEST 2006


Darrin Thompson wrote:
 > The processes were linked when at some point the users chose to 
communicate.

I think that is not a good idea to link processes in this case. You 
better to create a master process called, let's say, "router" which will 
route chat messages between processes. Also you can put some other stuff 
in router - packet filtering, address rewriting etc. :)

> Now suppose I keep the state of each process in an mnesia table.
 
Yes, that's a good idea. Also this approach will be "cluster transparent" for the router. But don't forget to delete state on processes terminating. That is simple to do via terminate/3 if you use gen_fsm behaviour for client processes.





More information about the erlang-questions mailing list