[erlang-questions] Shared ETS Access

Adam Kelly cthulahoops@REDACTED
Mon Jan 11 11:23:09 CET 2010


2010/1/10 Colm Dougan <colm.dougan@REDACTED>:
> You will notice that the 'get' function uses the fact that the ets
> table is 'public' and queries it directly in the context of the
> calling process, and without calling into the gen_server process which
> created the table.  (If the ets table were private then the get
> function would have to be implemented in the same way as the 'put'
> function i.e. by "calling into" the process encapsulating the
> gen_server).

In this case, you can use protected instead of public or private,
which allows anyone to read from the table but only the owner to
write.  This is the default value, probably because it is mostly what
you want.

Adam.


More information about the erlang-questions mailing list