diff options
author | Anthony Ramine <[email protected]> | 2014-05-09 16:01:49 +0200 |
---|---|---|
committer | Zandra Hird <[email protected]> | 2015-03-12 10:15:14 +0100 |
commit | 0e464f7be1ae9b54d0fba748ab2dc7bd435ac118 (patch) | |
tree | 13ae71cc4a3b95fce407254783003d0d5d63c70a /lib/stdlib/src/ets.erl | |
parent | 0ec91ff571518e199aac7a4da961a80c153483b9 (diff) | |
download | otp-0e464f7be1ae9b54d0fba748ab2dc7bd435ac118.tar.gz otp-0e464f7be1ae9b54d0fba748ab2dc7bd435ac118.tar.bz2 otp-0e464f7be1ae9b54d0fba748ab2dc7bd435ac118.zip |
Create new BIF ets:update_counter/4
Conflicts:
erts/emulator/beam/bif.tab
lib/stdlib/src/ets.erl
Diffstat (limited to 'lib/stdlib/src/ets.erl')
-rw-r--r-- | lib/stdlib/src/ets.erl | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/lib/stdlib/src/ets.erl b/lib/stdlib/src/ets.erl index 26b0393b35..f58b274821 100644 --- a/lib/stdlib/src/ets.erl +++ b/lib/stdlib/src/ets.erl @@ -72,7 +72,7 @@ select_count/2, select_delete/2, select_reverse/1, select_reverse/2, select_reverse/3, setopts/2, slot/2, take/2, - update_counter/3, update_element/3]). + update_counter/3, update_counter/4, update_element/3]). -spec all() -> [Tab] when Tab :: tab(). @@ -439,6 +439,38 @@ take(_, _) -> update_counter(_, _, _) -> erlang:nif_error(undef). +-spec update_counter(Tab, Key, UpdateOp, Default) -> Result when + Tab :: tab(), + Key :: term(), + UpdateOp :: {Pos, Incr} + | {Pos, Incr, Threshold, SetValue}, + Pos :: integer(), + Incr :: integer(), + Threshold :: integer(), + SetValue :: integer(), + Result :: integer(), + Default :: tuple(); + (Tab, Key, [UpdateOp], Default) -> [Result] when + Tab :: tab(), + Key :: term(), + UpdateOp :: {Pos, Incr} + | {Pos, Incr, Threshold, SetValue}, + Pos :: integer(), + Incr :: integer(), + Threshold :: integer(), + SetValue :: integer(), + Result :: integer(), + Default :: tuple(); + (Tab, Key, Incr, Default) -> Result when + Tab :: tab(), + Key :: term(), + Incr :: integer(), + Result :: integer(), + Default :: tuple(). + +update_counter(_, _, _, _) -> + erlang:nif_error(undef). + -spec update_element(Tab, Key, ElementSpec :: {Pos, Value}) -> boolean() when Tab :: tab(), Key :: term(), |