ets behavior

Alin Popa <>
Thu Jun 11 07:10:38 CEST 2009


Hi,

I have the following behavior when using ets:

*1> ets:new(test, [named_table, public]).
test
2> ets:insert(test, {self(), 0}).
true
3> ets:update_counter(test, self(), 1).
1
4> ets:update_counter(test, self(), 2).
3
5> ets:update_counter(test, self(), 3).
6
6> ets:lookup(test, self()).
[{<0.33.0>,6}]
7> ets:info(test, self()).
** exception error: bad argument
     in function  ets:info/2
        called as ets:info(test,<0.33.0>)
8> ets:update_counter(test, self(), 1).
** exception error: bad argument
     in function  ets:update_counter/3
        called as ets:update_counter(test,<0.41.0>,1)
9> ets:update_counter(test, self(), 3).
** exception error: bad argument
     in function  ets:update_counter/3
        called as ets:update_counter(test,<0.43.0>,3)
10> ets:update_counter(test, self(), 4).
** exception error: bad argument
     in function  ets:update_counter/3
        called as ets:update_counter(test,<0.45.0>,4)
11>
*
What is happening here ? Why my counter (called test) is crashed ? A repair
function should be called or something ?

Thanks.


-- 
Regards,

Alin


More information about the erlang-questions mailing list