[erlang-questions] atomic ets:take_first, ets:take_last
Jesper Louis Andersen
Thu Jul 14 20:19:41 CEST 2016
On Thu, Jul 14, 2016 at 8:06 PM, Alexandre Beniaminov <abeniaminov@REDACTED
You have to say what you expect to be atomic/linearizable. In your above
code, suppose you are being scheduled out between the call to ets:first/1
and ets:take/2. Now, anything can happen in between, so in particular,
ets:take/2 may return  if the key was deleted or taken out by another
process between the two calls.
But taken individually, the set of ets:first/1, ets:take/2 and ets:lookup/2
ought to be linearizable. I.e., there is some point in time (the atomic
commit-point) at which ets:take/2 removes the objects. After this
commit-point first/1 and lookup/2 will not see the Key present in the table
So the question of if it is atomic or not depends on the precise definition
of what you ask.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions