Atomic ets

Sean Hinde sean.hinde@REDACTED
Tue Dec 13 19:45:53 CET 2005


On 13 Dec 2005, at 17:35, Rick Pettit wrote:

> On Tue, Dec 13, 2005 at 05:30:26PM +0100, Tony Rogvall wrote:
>>
>> On 13 dec 2005, at 15.45, Thomas Lindgren wrote:
>>
>>>
>>> Now that we are getting a multithreaded runtime
>>> system, is this a good time to bring up ets? I am
>>> having some issues here.
>>
>> For what it's worth I wrote a module called atomic.erl some time ago.
>> It can be regarded as
>> lightweight but it uses ets and monitor heavily to avoid
>> synchronizing with a server process.
>
> Why not use global:trans/[234]?
>
The requirement was to avoid serialising all ets read/updates through  
a gen_server. Global transactions require 2 gen_server calls (one to  
lock/one to unlock) to save one call.

Tony's solution relies solely on ets access from the local process to  
achieve locking. No other processes involved (except one to own the  
public ets table).

Sean




More information about the erlang-questions mailing list