[erlang-patches] Re: gen:call({global, Name}, ...)
Ulf Wiger
ulf.wiger@REDACTED
Thu Mar 31 21:05:43 CEST 2011
Hi Geoff,
I agree. Safe_whereis_name/1 doesn't really protect against anything. It does, perhaps reduce the window of some unwanted events, but it doesn't eliminate them.
We did some interesting tests with QuickCheck PULSE on a predecessor of Gproc. Basically, with true concurrency, and even more so in a distributed setting, these sorts of races are not possible to eliminate - at least not without exorbitant costs.
For this reason, gproc:where/1 simply does an ets:lookup(), even in the global case.
BR,
Ulf W
On 31 Mar 2011, at 20:16, Geoff Cant wrote:
> To my mind, this doesn't seem to add much safety. The whereis_name/1
> operation is a single ets:lookup, and ets guarantees us that this read
> is atomic, so the result of the lookup can't be affected by operations
> that require the global lock anyway.
Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com
More information about the erlang-patches
mailing list