Taking over a global name
Tue Mar 29 22:12:33 CEST 2005
Since this is something that isn't easy to test thouroughly, because of all
the strange race conditions, I hope someone will have a little spare time to
look at the following code and review it.
The problem to be solved is how to do a takeover between two processes,
without OTP startup files (as Ulf showed us earlier). One major requirement
is that no messages should be lost or come out of order.
The code doesn't handle errors, but is supposed to show the bare bones of my
implementation. Please feel free to criticize, and show simpler
implementations if they are possible.
The crux lies in takeover/2: the current process should be put on hold (so
it doesn't eat any more messages), the name is re_registered (the new
process must be in a special state, so that no messages are eaten), old
process flushes any messages to the new ones, and then the new one gets to
This is probably very similar to the application start phases described by
Ulf, but useful if one wants to do it with "simple" processes.
Is there a reason why there isn't a re_register bif for local names?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 920 bytes
Desc: not available
More information about the erlang-questions