[erlang-questions] Shared ETS Access

Zoltan Lajos Kis kiszl@REDACTED
Mon Jan 11 11:36:00 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.
>

Is there any advantage in writing to the table through a server process,
instead of directly writing to the table (perhaps using the
write-concurrency switch) ?





More information about the erlang-questions mailing list