[erlang-questions] Preventing a race condition when using dets/ets

Dave Bryson daveb@REDACTED
Wed May 7 15:48:23 CEST 2008


Say for example I have the following code:

{_,N} = ets:lookup(?MODULE,counter),
ok = ets:insert(?MODULE, {counter, N+1}).

and two processes attempt to access the code at the same time. What's  
the best approach to prevent a race condition in this situation?

Thanks,
Dave
  
             



More information about the erlang-questions mailing list