[erlang-questions] atomic ETS update with a function?

Lukas Larsson garazdawi@REDACTED
Tue Nov 20 10:36:10 CET 2018


Hello,

On Mon, Nov 19, 2018 at 7:44 PM Vans S <vans_163@REDACTED> wrote:

> Currently there is no atomic function to update a ETS value when its not a
> tuple.  For example if one of my ETS values is a map, and I want to put an
> element into the map, I have no atomic way to do so.
>
> Is there anyone else that really has a need for a function like
> :ets.update/3 where arg 1 is ets_table, 2 is key, 3 is fun callback that is
> called passing the original element and the reply should be the new element?
>

I've long wanted to do this for match specs, it would however be a huge
undertaking to implement this. The main problem is what to do if the
process runs out of reductions while doing the update.

Should it be allowed to continue to run? and thus potentially starve other
processes.
Should it be preempted? what do we then do with the locks on the ETS table?

Lukas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181120/54306ed8/attachment.htm>


More information about the erlang-questions mailing list