Atomic ets

Joe Armstrong (AL/EAB) joe.armstrong@REDACTED
Wed Dec 14 09:19:52 CET 2005


   Agggggggggggggggggggggggggghhhhhhhhhhhhhhhhhh

   Verily verily verify I say untoo ye

   Even thou thy hath vouchsafed a lock - and even though thy
thath promest to delivery it back - there will come a day
when the Great one will return and the lock will be raised
and there will be much gnashing of teeth and wailing and
the bones of the long dead will rise and dance on the graves
of the unfrocked bishops.

   /Joe

 

 
> -----Original Message-----
> From: owner-erlang-questions@REDACTED
> [mailto:owner-erlang-questions@REDACTED]On Behalf Of Mats Cronqvist
> Sent: den 13 december 2005 17:35
> To: erlang-questions
> Subject: Re: Atomic ets
> 
> 
>    years ago, i suggested to OTP that adding atomic 
> expressions (similar to 
> block expressions) to Erlang would allow one to solve this 
> kind of problems. like;
> 
> atomic
>    case ets:lookup(a,b) of
>      [] -> ets:insert(a,c);
>      _ -> ok
>    end
> end
> 
>    inside the atomic block you'd be guaranteed not to be 
> scheduled out.
>    i don't remember if they laughed hysterically or just 
> waited for me to go 
> away, but nothing came of it. quite possibly there were good 
> reasons for that.
> 
>    mats
> 
> p.s. of course it'd be really easy to crush the emulator with 
> this feature. i 
> don't think that's a good reason for nixing it though.
> 
> 
> Ulf Wiger (AL/EAB) wrote:
> >  
> > Thomas Lindgren wrote:
> > 
> >>1. Am I being dense in writing my ets code? Are there simple, 
> >>useful ways to write ets code that avoids the problem of 
> >>getting preempted between, say, a lookup and an insert?
> > 
> > 
> > Well, yes (on the second question). You can make sure that 
> > all updates to a table are serialized using e.g. a gen_server.
> > 
> > You can then pass the server an update fun if you want.
> > 
> > /Uffe
> 



More information about the erlang-questions mailing list