Atomic ets

Tony Rogvall <>
Tue Dec 13 17:30:26 CET 2005


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.

Could possibly be fun for some verifier to analyze, if not the flaws  
are obvious ;-)

Also it can possibly be used to verify (if it works) that the ets is  
multithread safe...

No documentation nor support is given ... (as always)

Typical use:

	Key = foobar, %% could be any term
	atomic:lock(Key),
	do_something(),
	atomic:unlock(Key)

This can be condensed into atomic:exec(Key, fun() -> do_something()  
end).

Note that the atomic needs a gen_server that owne the locker table to  
work.

BTW the macro dbg_schedule can be used to verify if the atomic module  
works,
it forces context switches in some places.


/Tony
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic.erl
Type: application/octet-stream
Size: 9025 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20051213/8662e7de/attachment.obj>
-------------- next part --------------



More information about the erlang-questions mailing list