[erlang-questions] ETS Multiple Choice Question

Hakan Mattsson <>
Wed Dec 12 11:41:11 CET 2007

On Wed, 12 Dec 2007, Bjorn Gustavsson wrote:

BG> Lev Walkin <> writes:
BG> > Sean Hinde wrote:
BG> > > No locking is available in ets.
BG> > > 
BG> > > Limited support means that a single read or write will succeed without  
BG> > > being corrupted by another concurrent read/write. If you want locking  
BG> > > across mutiple read/writes then look at mnesia
BG> > 
BG> > What about write in the middle of foldr?
BG> We have updated the documentation in R12B to make that clearer:
BG> "If Function inserts objects into the table, or
BG> another process inserts objects into the table, those
BG> objects *may* (depending on key ordering) be included
BG> in the traversal."

An undocumented feature of ets foldr/foldl is that they
are internally using ets:safe_fixtable/2 to temporarily
turn off the automatic rehashing. This means that if you
are using other means of iterating over an ets table,
the level of unpredictability is even greater if the
table grows or shrinks during the iteration.


More information about the erlang-questions mailing list